Skip to content

Commit 29e8df5

Browse files
authored
Merge pull request #195 from jnareb/rn20-default_abbrev
rn20: Changing the default for "core.abbrev"?
2 parents a6b4a01 + 1565bc5 commit 29e8df5

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

rev_news/drafts/edition-20.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,46 @@ This edition covers what happened during the month of September 2016.
2424

2525
### Reviews
2626

27+
* [Changing the default for "core.abbrev"?](http://public-inbox.org/git/CA+55aFy0_pwtFOYS1Tmnxipw9ZkRNCQHmoYyegO00pjMiZQfbg@mail.gmail.com/)
28+
29+
Linus Torvalds asked for increasing the default value for number of
30+
characters in SHA-1 abbreviations. The `default_abbrev = 7` was
31+
reasonable at early days of Git, but the project of size of the
32+
Linux kernel needs `git config --global core.abbrev 12`; while Git
33+
will extend the seven hex digits until the object name is unique,
34+
that only reflects the *current* situation in the repository. It gets
35+
annoying when a commit message has a short git ID that is no longer
36+
unique a few months later when one needs to go back and try to figure
37+
out what went wrong in that commit.
38+
39+
Jeff King, alias Peff, answered the *"it gets annoying"* part in the
40+
[[PATCH 0/10] helping people resolve ambiguous sha1s](https://public-inbox.org/git/[email protected]/)
41+
patch series (merged in [66c22ba6](https://git.kernel.org/cgit/git/git.git/commit/?id=66c22ba6fbe0724ecce3d82611ff0ec5c2b0255f)).
42+
This patch series taught Git to help in the situation where only
43+
ambiguous shortened identifier is available, by listing the SHA-1s
44+
of the objects it found, along with a few bits of information that
45+
may help the user decide which one they meant.
46+
47+
> $ git rev-parse b2e1
48+
> error: short SHA1 b2e1 is ambiguous
49+
> hint: The candidates are:
50+
> hint: b2e1196 tag v2.8.0-rc1
51+
> hint: b2e11d1 tree
52+
> hint: b2e1632 commit 2007-11-14 - Merge branch 'bs/maint-commit-options'
53+
> hint: b2e1759 blob
54+
> hint: b2e18954 blob
55+
> hint: b2e1895c blob
56+
57+
The problem of Git providing SHA-1 abbreviation which would soon be
58+
invalid was solved in different way than proposed by Linus. Instead
59+
of increasing the default abbrev length for all projects, making abbrevs
60+
longer and more unwieldy also for small projects that don't need it,
61+
Peff [proposed](https://public-inbox.org/git/[email protected]/)
62+
to make default abbrev length be dynamically based on the number of objects
63+
in the repository. Linus sent [rough implementation](https://public-inbox.org/git/CA+55aFwbCNiF0nDppZ5SuRcZwc9kNvKYzgyd_bR8Ut8XRW_p4Q@mail.gmail.com/)
64+
of this idea, which after a few iterations (and cleanups of related code)
65+
got merged into 'next' as [bb188d00f7](https://github.com/git/git/commit/bb188d00f7).
66+
2767
* [Prepare the sequencer for the upcoming rebase -i patches](http://public-inbox.org/git/[email protected]/)
2868

2969
Johannes Schindelin, alias Dscho, is the maintainer of Git for

0 commit comments

Comments
 (0)