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

Re: [PATCH 19/20] abbrev: support relative abbrev values

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 14, 2018, 15:50 UTC
Message-ID
<xmqq602l5pvs.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<87zhzxvmyv.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 31 quoted lines
> On Wed, Jun 13 2018, Junio C Hamano wrote:
>
>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>
>>> E.g. here's a breakdown of my dotfiles repo:
>>>
>>>     $ git -c core.abbrev=4 log  --pretty=format:%h|perl -nE 'chomp;say length'|sort|uniq -c|sort -nr
>>>         784 4
>>>          59 5
>>>           7 6
>>>
>>> I don't have a single commit that needs 7 characters, yet that's our
>>> default. This is a sane trade-off for the kernel, but for something
>>> that's just a toy or something you're playing around with something
>>> shorter can make sense.
>>>
>>> SHA-1s aren't just written down, but also e.g. remembered in wetware
>>> short-term memory.
>>
>> That's a fine example of what I called "supporting absurdly small
>> absolute values like 4"; I still do not see why you want "negative
>> relative values" from that example.
>
> Because hardcoding -2 is very different than setting it to 5, because
> the -2 will scale to the size of the repository, but 5 is just 7-2 where
> 7 is our default value.
>
> So, in general if you want less future proof hashes by some
> probabilistic metric (whether you use core.validateAbbrev or not) you'd
> use -2 or -3, just like you might use +2 or +3 if you'd like to have
> more future-proof hashes (especially with core.validateAbbrev=true).
That still does not make much sense to me at all.

I do agree that something shorter than the default 7 may be more appropriate for our wetware short-term memory, and it would make sense to grow the "riskier to collide than the default heuristics but more memorable" variant as the project grows, _ONLY_ _IF_ our wetware short-term memory scales with the project we happen to be working on. But our wetware does not scale with the project we work on; at least mine does not.

So...
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 19 of 37 in “unconditional O(1) SHA-1 abbreviation”
  1. 00/20 unconditional O(1) SHA-1 abbreviationÆvar Arnfjörð Bjarmason, Jun 8, 2018
  2. 01/20 t/README: clarify the description of test_line_countÆvar Arnfjörð Bjarmason, Jun 8, 2018
  3. 02/20 test library: add a test_byte_countÆvar Arnfjörð Bjarmason, Jun 8, 2018
  4. 04/20 abbrev tests: add tests for core.abbrev and --abbrevÆvar Arnfjörð Bjarmason, Jun 8, 2018
  5. Junio C HamanoJun 12, 2018
  6. 07/20 abbrev tests: test "git branch" behaviorÆvar Arnfjörð Bjarmason, Jun 8, 2018
  7. 10/20 abbrev tests: test for "git-diff" behaviorÆvar Arnfjörð Bjarmason, Jun 8, 2018
  8. 14/20 config.c: use braces on multiple conditional armsÆvar Arnfjörð Bjarmason, Jun 8, 2018
  9. 16/20 abbrev: unify the handling of non-numeric valuesÆvar Arnfjörð Bjarmason, Jun 8, 2018
  10. 17/20 abbrev: unify the handling of empty valuesÆvar Arnfjörð Bjarmason, Jun 8, 2018
  11. Martin ÅgrenJun 9, 2018
  12. Martin ÅgrenJun 9, 2018
  13. 19/20 abbrev: support relative abbrev valuesÆvar Arnfjörð Bjarmason, Jun 8, 2018
  14. Martin ÅgrenJun 9, 2018
  15. Junio C HamanoJun 12, 2018
  16. Ævar Arnfjörð BjarmasonJun 13, 2018
  17. Junio C HamanoJun 13, 2018
  18. Ævar Arnfjörð BjarmasonJun 14, 2018
  19. Junio C HamanoJun 14, 2018
  20. Ævar Arnfjörð BjarmasonJun 14, 2018
  21. 20/20 abbrev: add a core.validateAbbrev settingÆvar Arnfjörð Bjarmason, Jun 8, 2018
  22. Martin ÅgrenJun 9, 2018
  23. Junio C HamanoJun 12, 2018
  24. 18/20 abbrev parsing: use braces on multiple conditional armsÆvar Arnfjörð Bjarmason, Jun 8, 2018
  25. 09/20 abbrev tests: test for "git-log" behaviorÆvar Arnfjörð Bjarmason, Jun 8, 2018
  26. Martin ÅgrenJun 9, 2018
  27. Ævar Arnfjörð BjarmasonJun 9, 2018
  28. Martin ÅgrenJun 9, 2018
  29. 15/20 parse-options-cb.c: use braces on multiple conditional armsÆvar Arnfjörð Bjarmason, Jun 8, 2018
  30. 12/20 abbrev tests: test for --abbrev and core.abbrev=[+-]NÆvar Arnfjörð Bjarmason, Jun 8, 2018
  31. 13/20 parse-options-cb.c: convert uses of 40 to GIT_SHA1_HEXSZÆvar Arnfjörð Bjarmason, Jun 8, 2018
  32. 06/20 blame: fix a bug, core.abbrev should work like --abbrevÆvar Arnfjörð Bjarmason, Jun 8, 2018
  33. 08/20 abbrev tests: test for "git-describe" behaviorÆvar Arnfjörð Bjarmason, Jun 8, 2018
  34. 11/20 abbrev tests: test for plumbing behaviorÆvar Arnfjörð Bjarmason, Jun 8, 2018
  35. 03/20 blame doc: explicitly note how --abbrev=40 gives 39 charsÆvar Arnfjörð Bjarmason, Jun 8, 2018
  36. Junio C HamanoJun 12, 2018
  37. 05/20 abbrev tests: test "git-blame" behaviorÆvar Arnfjörð Bjarmason, Jun 8, 2018

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.