From: Nguyễn Thái Ngọc Duy Date: Thu, 26 Jul 2007 03:14:54 +0000 (-0400) Subject: git-write-tree should not crash if prefix does not exist X-Git-Tag: v1.5.3-rc4~60 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b87841e1645f900fbec0a937a45f98b70b5684ca;p=git.git git-write-tree should not crash if prefix does not exist Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff --git a/builtin-write-tree.c b/builtin-write-tree.c index 391de5397..88f34ba7d 100644 --- a/builtin-write-tree.c +++ b/builtin-write-tree.c @@ -52,6 +52,8 @@ int write_tree(unsigned char *sha1, int missing_ok, const char *prefix) if (prefix) { struct cache_tree *subtree = cache_tree_find(active_cache_tree, prefix); + if (!subtree) + die("git-write-tree: prefix %s not found", prefix); hashcpy(sha1, subtree->sha1); } else