summaryrefslogtreecommitdiff
path: root/cache-tree.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-05-16 11:51:50 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-05-16 11:51:50 +0900
commitf767178a5ada848867a7378053897bdfbac32590 (patch)
tree5a6a8f49b53dd52fc5e31bdb6a67105642399d93 /cache-tree.c
parentMerge branch 'dt/raise-core-packed-git-limit' (diff)
parentcache-tree: reject entries with null sha1 (diff)
downloadtgif-f767178a5ada848867a7378053897bdfbac32590.tar.xz
Merge branch 'jk/no-null-sha1-in-cache-tree'
Code to update the cache-tree has been tightened so that we won't accidentally write out any 0{40} entry in the tree object. * jk/no-null-sha1-in-cache-tree: cache-tree: reject entries with null sha1
Diffstat (limited to 'cache-tree.c')
-rw-r--r--cache-tree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 345ea35963..34baa6d85a 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -354,7 +354,9 @@ static int update_one(struct cache_tree *it,
entlen = pathlen - baselen;
i++;
}
- if (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1)) {
+
+ if (is_null_sha1(sha1) ||
+ (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1))) {
strbuf_release(&buffer);
if (expected_missing)
return -1;