Subject: Re: [PATCH] abbrev: allow extending beyond 20 chars to disambiguate

From: Junio C Hamano <[email-masked]>
Date: Mon, 11 Aug 2025 11:53:56 -0700

Junio C Hamano <[email-masked]> writes:

> 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.