git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 11, 2025, 21:28 UTC
Message-ID
<xmqqzfc5zgxt.fsf@gitster.g>
In-Reply-To
<xmqq4iud1rfm.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 11 quoted lines
> "brian m. carlson" <sandals@crustytoothpaste.net> writes:
>
>> On 2025-08-11 at 15:26:32, Junio C Hamano wrote:
>>> When you have two or more objects with object names that share more
>>> than half the length of the hash algorithm in use (e.g. 10 bytes for
>>> SHA-1 that produces 20-byte/160-bit hash), find_unique_abbrev()
>>> fails to show disambiguation.
>>
>> Is this really the case?  
>
> What I wrote in the above is correct.

Sorry, I meant "incorrect". And using GIT_MAX_HEXSZ will break the abbreviation system rather badly. It has to be the length of the hash that is being used.

Show 11 quoted lines
>
>> If the restriction is due to using
>> GIT_MAX_RAWSZ instead of GIT_MAX_HEXSZ, then that's 32 vs. 64 in our
>> modern codebase.
>
> The above numbers are correct but irrelevant ;-).
>
> The thing is, the offending commit changed from 40-bytes
> (GIT_SHA1_HEXSZ) to 32-bytes (GIT_MAX_RAWSZ).  Plase see v2 patch.
>
> Thanks.
Previous: Junio C HamanoNext: Jon Forrest
Message 12 of 14 in “abbrev: allow extending beyond 20 chars to disambiguate”
  1. abbrev: allow extending beyond 20 chars to disambiguateJunio C Hamano, Aug 11, 2025
  2. Junio C HamanoAug 11, 2025
  3. abbrev: allow extending beyond 20 chars to disambiguateJunio C Hamano, Aug 11, 2025
  4. brian m. carlsonAug 11, 2025
  5. Derrick StoleeAug 12, 2025
  6. René ScharfeAug 12, 2025
  7. Junio C HamanoAug 12, 2025
  8. René ScharfeAug 12, 2025
  9. abbrev: allow extending beyond 32 chars to disambiguateJunio C Hamano, Aug 14, 2025
  10. brian m. carlsonAug 11, 2025
  11. Junio C HamanoAug 11, 2025
  12. Junio C HamanoAug 11, 2025
  13. Jon ForrestAug 12, 2025
  14. René ScharfeAug 12, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.