Re: [PATCH] sha1_file: add slash once in for_each_file_in_obj_subdir()
- From
René Scharfe <l.s.r@web.de>
- Date
- Jul 12, 2017, 17:58 UTC
- Message-ID
- <0465f03f-3d60-15f5-6d67-80b46b6c8c5f@web.de>
- In-Reply-To
- <xmqq8tjx82kf.fsf@gitster.mtv.corp.google.com>
Am 10.07.2017 um 04:10 schrieb Junio C Hamano:
Show 13 quoted lines
> Jeff King <peff@peff.net> writes: > >> ... And you could even drop origlen by >> replacing it with "baselen - 3" at the end. But somehow doing the >> computation on the fly actually seems more complicated to me (from the >> perspective of a reader who is trying to make sure all is correct). > > True enough. I personally do not mind any of the three variants > (including the original) and would rather not spend too much time > micro-optimizing this codepath, lest the next clever person starts > to turn the loop in for_each_loose_file_in_objdir() to a nested loop > that runs 16 times each to avoid copying the same leading byte again > and again ;-)
*evil grin*
Anyway, I agree that this patch is not worth spending much time on. I still think the result is cleaner (perhaps due to my strbuf_addf allergy), though it's longer and perhaps adding a twelfth variable makes the function too complicated. The magic chomping variant is a clever compromise -- but needs a comment to explain itself. So if you are indifferent please just drop it.
Thanks, René