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

Re: [PATCH] find_unique_abbrev(): honor caller-supplied "len" better

From
Namhyung Kim <namhyung@gmail.com>
Date
Mar 13, 2011, 13:30 UTC
Message-ID
<1300023026.1450.1.camel@leonhard>
In-Reply-To
<7vvczpff89.fsf@alter.siamese.dyndns.org>
2011-03-11 (금), 14:45 -0800, Junio C Hamano:
Show 54 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > So let's scrap the abbrevguard thing.  I somehow thought that I already
> > took your "make DEFAULT_ABBREV tweakable" patch, but apparently I didn't.
> > That one is the real fix to the issue of futureproofing.
> 
> In return for a free education last night, I now owe you your patch from
> October last year, resurrected from the list archive, and here it is.
> 
> With a forged sign-off from you, as I know that everything you write is
> supposed to be open source.
> 
>  - I do not think making minimum configurable is worth it, but I left it in
>    (there is no UI to tweak it anyway).
> 
>  - I somewhat tweaked "describe" and "describe --abbrev" implementation.
>    OPT__ABBREV() uses DEFAULT_ABBREV in its callback, so we need to read
>    from the configuration before calling parse_options().  As it won't
>    make any sense to call "git describe" outside repository where you
>    cannot get to your configuration, I think it is safe to add a call to
>    git_config() in this codepath. Other users of OPT__ABBREV() may need to
>    be audited.
> 
> By the way, I've already reverted the abbrevguard thing away.
> 
> -- >8 --
> From: Linus Torvalds <torvalds@linux-foundation.org>
> Date: Thu, 28 Oct 2010 11:28:04 -0700
> Subject: [PATCH] Make the default abbrev length configurable
> 
> The default of 7 comes from fairly early in git development, when
> seven hex digits was a lot (it covers about 250+ million hash
> values). Back then I thought that 65k revisions was a lot (it was what
> we were about to hit in BK), and each revision tends to be about 5-10
> new objects or so, so a million objects was a big number.
> 
> These days, the kernel isn't even the largest git project, and even
> the kernel has about 220k revisions (_much_ bigger than the BK tree
> ever was) and we are approaching two million objects. At that point,
> seven hex digits is still unique for a lot of them, but when we're
> talking about just two orders of magnitude difference between number
> of objects and the hash size, there _will_ be collisions in truncated
> hash values. It's no longer even close to unrealistic - it happens all
> the time.
> 
> We should both increase the default abbrev that was unrealistically
> small, _and_ add a way for people to set their own default per-project
> in the git config file.
> 
> This is the first step to first make it configurable; the default of 7
> is not raised yet.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
Reviewed-by: Namhyung Kim <namhyung@gmail.com>
Thanks.
-- 
Regards,
Namhyung Kim
Previous: Junio C HamanoNext: Jay Soffian
Message 16 of 18 in “Minimum git commit abbrev length (Was Re: -tip: origin tree build failure (was: [GIT PULL] ext4 update) for 2.6.37)”
  1. Ted Ts'oOct 28, 2010
  2. Linus TorvaldsOct 28, 2010
  3. Linus TorvaldsOct 28, 2010
  4. Brandon CaseyOct 29, 2010
  5. find_unique_abbrev(): honor caller-supplied "len" betterJunio C Hamano, Mar 10, 2011
  6. Linus TorvaldsMar 10, 2011
  7. Junio C HamanoMar 11, 2011
  8. Linus TorvaldsMar 11, 2011
  9. Junio C HamanoMar 11, 2011
  10. Linus TorvaldsMar 11, 2011
  11. Junio C HamanoMar 11, 2011
  12. Junio C HamanoMar 11, 2011
  13. Jeff KingMar 11, 2011
  14. Jeff KingMar 11, 2011
  15. Junio C HamanoMar 11, 2011
  16. Namhyung KimMar 13, 2011
  17. Jay SoffianMar 19, 2011
  18. Namhyung KimMar 19, 2011

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.