summaryrefslogtreecommitdiff
path: root/builtin-mktree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-05-10 17:45:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-05-10 19:41:35 (GMT)
commitad87b5dd93f61a046236febf1becc78d0ad6452a (patch)
treea559c6bc401b8c80a74c48f7c4fc241ab211a6ee /builtin-mktree.c
parentfe0bb5f7bce3dbcc32325c74e693a726d0c2808b (diff)
downloadgit-ad87b5dd93f61a046236febf1becc78d0ad6452a.zip
git-ad87b5dd93f61a046236febf1becc78d0ad6452a.tar.gz
git-ad87b5dd93f61a046236febf1becc78d0ad6452a.tar.bz2
mktree: do not barf on a submodule commit
It is perfectly normal if a tree entry points at a missing commit as long as the mode of the entry says it is a submodule. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-mktree.c')
-rw-r--r--builtin-mktree.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin-mktree.c b/builtin-mktree.c
index 133ab4b..17cdb3d 100644
--- a/builtin-mktree.c
+++ b/builtin-mktree.c
@@ -89,9 +89,16 @@ static void mktree_line(char *buf, size_t len, int line_termination)
ntr[41] != '\t' ||
get_sha1_hex(ntr + 1, sha1))
die("input format error: %s", buf);
- type = sha1_object_info(sha1, NULL);
+
+ /* It is perfectly normal if we do not have a commit from a submodule */
+ if (!S_ISGITLINK(mode))
+ type = sha1_object_info(sha1, NULL);
+ else
+ type = OBJ_COMMIT;
+
if (type < 0)
die("object %s unavailable", sha1_to_hex(sha1));
+
*ntr++ = 0; /* now at the beginning of SHA1 */
if (type != type_from_string(ptr))
die("object type %s mismatch (%s)", ptr, typename(type));