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

Re: [PATCH 3/3] abbrev: auto size the default abbreviation

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 3, 2016, 22:52 UTC
Message-ID
<xmqqoa313v0j.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161003224028.ksvwaplxe7a3vtwv@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 19 quoted lines
> On Mon, Oct 03, 2016 at 03:34:03PM -0700, Linus Torvalds wrote:
>
>> On Mon, Oct 3, 2016 at 3:27 PM, Jeff King <peff@peff.net> wrote:
>> >
>> > +       if (len < 0) {
>> > +               unsigned long count = approximate_object_count();
>> > +               len = (msb(count) + 1) / 2;
>> > +               if (len < 0)
>> > +                       len = FALLBACK_DEFAULT_ABBREV;
>> > +       }
>> 
>> that second "if (len < 0)" should probably be testing against
>> FALLBACK_DEFAULT_ABBREV, not zero. Or at the very least
>> MINIMUM_ABBREV. Because a two-character abbreviation won't even be
>> recognized, even if the git project is very small indeed.
>
> Oops, yes, clearly it should be FALLBACK_DEFAULT_ABBREV. What is there
> would not even pass the tests (it _does_ work on linux.git, of course,
> because it is much too large for that code to be triggered).

OK, as Linus's "count at the point of use" is already in 'next', could you make it incremental with a log message?

Thanks.
Previous: Jeff KingNext: Jeff King
Message 8 of 13 in “auto-sizing default abbreviation length”
  1. 0/3 auto-sizing default abbreviation lengthJunio C Hamano, Oct 1, 2016
  2. 1/3 abbrev: add FALLBACK_DEFAULT_ABBREV to prepare for auto sizingJunio C Hamano, Oct 1, 2016
  3. 2/3 abbrev: prepare for new world orderJunio C Hamano, Oct 1, 2016
  4. 3/3 abbrev: auto size the default abbreviationJunio C Hamano, Oct 1, 2016
  5. Jeff KingOct 3, 2016
  6. Linus TorvaldsOct 3, 2016
  7. Jeff KingOct 3, 2016
  8. Junio C HamanoOct 3, 2016
  9. Jeff KingOct 3, 2016
  10. Junio C HamanoOct 4, 2016
  11. Jeff KingOct 4, 2016
  12. Junio C HamanoNov 2, 2016
  13. Jeff KingNov 2, 2016

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.