summaryrefslogtreecommitdiff
path: root/builtin-write-tree.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2007-07-26 03:14:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-07-26 04:35:17 (GMT)
commitb87841e1645f900fbec0a937a45f98b70b5684ca (patch)
tree11a0b6034e19f01516cc8a74740b36960c393bd7 /builtin-write-tree.c
parente7a7be8831b159b9a7331b34c3ec6915d4a72190 (diff)
downloadgit-b87841e1645f900fbec0a937a45f98b70b5684ca.zip
git-b87841e1645f900fbec0a937a45f98b70b5684ca.tar.gz
git-b87841e1645f900fbec0a937a45f98b70b5684ca.tar.bz2
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>
Diffstat (limited to 'builtin-write-tree.c')
-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 391de53..88f34ba 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