Merge branch 'kw/write-index-reduce-alloc'
authorJunio C Hamano <gitster@pobox.com>
Mon, 25 Sep 2017 06:24:05 +0000 (15:24 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Sep 2017 06:24:06 +0000 (15:24 +0900)
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

read-cache.c
t/helper/.gitignore
index b211c57af6b418a24bb2eef97dabed0c95e53599..7d00265c494244a060e0104e9854d02fe1c6b44a 100644 (file)
@@ -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);
index 721650256e63eb51c66d5985c04bc3095f183c1c..7c9d28a8348341c148f150c3371d09dd98693b53 100644 (file)
@@ -35,3 +35,4 @@
 /test-svn-fe
 /test-urlmatch-normalization
 /test-wildmatch
+/test-write-cache