From b87841e1645f900fbec0a937a45f98b70b5684ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 25 Jul 2007 23:14:54 -0400 Subject: [PATCH] git-write-tree should not crash if prefix does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin-write-tree.c | 2 ++ 1 file changed, 2 insertions(+) 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 -- 2.26.2