diff --git a/read-cache.c b/read-cache.c index 1b82b156452e3b..c5e96158d0cb2a 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2172,7 +2172,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);