X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=read-cache.c;h=49607ddcd7078fb47bac660c39a777a5569d3f80;hb=00a4b0350198ce2039af2360ff5d83a1f8ee6cd9;hp=2eb81a66b941325dc339d61a0ab804a60cbb8be2;hpb=156e1782a88d882faf66680b5155a1c140e86a56;p=thirdparty%2Fgit.git diff --git a/read-cache.c b/read-cache.c index 2eb81a66b9..49607ddcd7 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2104,13 +2104,15 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce, struct strbuf *previous_name, struct ondisk_cache_entry *ondisk) { int size; - int saved_namelen = saved_namelen; /* compiler workaround */ int result; + unsigned int saved_namelen; + int stripped_name = 0; static unsigned char padding[8] = { 0x00 }; if (ce->ce_flags & CE_STRIP_NAME) { saved_namelen = ce_namelen(ce); ce->ce_namelen = 0; + stripped_name = 1; } if (ce->ce_flags & CE_EXTENDED) @@ -2150,7 +2152,7 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce, strbuf_splice(previous_name, common, to_remove, ce->name + common, ce_namelen(ce) - common); } - if (ce->ce_flags & CE_STRIP_NAME) { + if (stripped_name) { ce->ce_namelen = saved_namelen; ce->ce_flags &= ~CE_STRIP_NAME; }