Re: [PATCH] update-index: Don't copy memory around
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 23, 2015, 17:11 UTC
- Message-ID
- <xmqq1tkfbpw3.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1427129620-13380-1-git-send-email-sbeller@google.com>
Stefan Beller <sbeller@google.com> 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.