aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2007-07-25 23:14:54 -0400
committerJunio C Hamano <gitster@pobox.com>2007-07-25 21:35:17 -0700
commitb87841e1645f900fbec0a937a45f98b70b5684ca (patch)
tree11a0b6034e19f01516cc8a74740b36960c393bd7
parente7a7be8831b159b9a7331b34c3ec6915d4a72190 (diff)
downloadgit-b87841e1645f900fbec0a937a45f98b70b5684ca.tar.gz
git-b87841e1645f900fbec0a937a45f98b70b5684ca.tar.xz
git-write-tree should not crash if prefix does not exist
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin-write-tree.c2
1 files changed, 2 insertions, 0 deletions
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