From: Junio C Hamano Date: Mon, 23 Mar 2015 17:11:08 GMT Subject: Re: [PATCH] update-index: Don't copy memory around Message-ID: In-Reply-To: <1427129620-13380-1-git-send-email-sbeller@google.com> Stefan Beller writes: > ... though I do not understand > why. This passes the test suite, so I wonder if this patch would be a subtle bug > now. I recall the last time I traced the code I noticed that the ce can get passed to a codepath that causes its removal from update_one(), and then the pathname itself (which used to be ce->name but remember that ce is invalid already at that point!) is still used after ce is removed, which was the reason why you would introduce a bug if you stop copying the path. You may have to follow the code again a bit closer to make sure but I am reasonably sure that was the reason.