summaryrefslogtreecommitdiff
path: root/object-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'object-file.c')
-rw-r--r--object-file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/object-file.c b/object-file.c
index 811c569ed3..84c9249dab 100644
--- a/object-file.c
+++ b/object-file.c
@@ -1620,7 +1620,11 @@ int index_path(struct index_state *istate, struct object_id *oid,
strbuf_release(&sb);
break;
case S_IFDIR:
- return repo_resolve_gitlink_ref(istate->repo, path, "HEAD", oid);
+ if (repo_resolve_gitlink_ref(istate->repo, path, "HEAD", oid))
+ return error(_("'%s' does not have a commit checked out"), path);
+ if (&hash_algos[oid->algo] != istate->repo->hash_algo)
+ return error(_("cannot add a submodule of a different hash algorithm"));
+ break;
default:
return error(_("%s: unsupported file type"), path);
}