Re: [PATCH] abbrev: allow extending beyond 20 chars to disambiguate
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 11, 2025, 18:53 UTC
- Message-ID
- <xmqq5xet3d17.fsf@gitster.g>
- In-Reply-To
- <xmqqfrdx517b.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> keeps extending the abbreviation. The loop stops at GIT_MAX_RAWSZ, > which is counted as the number of bytes, since 5b20ace6 (sha1_name: > unroll len loop in find_unique_abbrev_r(), 2017-10-08); before that > change, it extended up to GIT_MAX_HEXSZ, which is the correct limit > because the loop is adding one output letter per iteration.
This is half a truth. It is correct that the loop used to terminate at GIT_SHA1_HEXSZ, and replacing it with GIT_MAX_HEXSZ is wrong, as MAX_HEXSZ can be much larger than the max hexsz for the hash function in use in the repository.
I'll be sending a reworked version that takes the current hash function into account.