summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-09-25 15:24:05 +0900
committerJunio C Hamano <gitster@pobox.com>2017-09-25 15:24:06 +0900
commitd085f9773a8f53a517a32f0c55a8c49a7cc773a1 (patch)
tree531b936f092dc60267cf712b2da5f28b37f3398d /read-cache.c
parentb0df15a15d6479508676757e810419141516754f (diff)
parent0b90b881e0c1de110c724fe63df6d2c3c9680d6a (diff)
downloadgit-d085f9773a8f53a517a32f0c55a8c49a7cc773a1.tar.gz
Merge branch 'kw/write-index-reduce-alloc'
A hotfix to a topic already in 'master'. * kw/write-index-reduce-alloc: read-cache: fix index corruption with index v4 Add t/helper/test-write-cache to .gitignore
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index b211c57af6..7d00265c49 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2103,7 +2103,9 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce,
if (!result)
result = ce_write(c, fd, to_remove_vi, prefix_size);
if (!result)
- result = ce_write(c, fd, ce->name + common, ce_namelen(ce) - common + 1);
+ result = ce_write(c, fd, ce->name + common, ce_namelen(ce) - common);
+ if (!result)
+ result = ce_write(c, fd, padding, 1);
strbuf_splice(previous_name, common, to_remove,
ce->name + common, ce_namelen(ce) - common);