aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--read-cache.c4
-rw-r--r--t/helper/.gitignore1
2 files changed, 4 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index b211c57af..7d00265c4 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);
diff --git a/t/helper/.gitignore b/t/helper/.gitignore
index 721650256..7c9d28a83 100644
--- a/t/helper/.gitignore
+++ b/t/helper/.gitignore
@@ -35,3 +35,4 @@
/test-svn-fe
/test-urlmatch-normalization
/test-wildmatch
+/test-write-cache