[PATCH 4/4] core.abbrev: raise the default abbreviation to 12 hexdigits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As Peff said, responding in a thread started by Linus's suggestion
to raise the default abbreviation to 12 hexdigits:

    I actually think "12" might be sane for a long time. That's 48 bits of
    sha1, so we'd expect a 50% change of a _single_ collision at 2^24, or 16
    million.  The biggest repository I know about (in number of objects) is
    the one holding all of the objects for all of the forks of
    torvalds/linux on GitHub. It's at about 15 million objects.

    Which _seems_ close, but remember that's the size where we expect to see
    a single collision. They don't become common until much later (I didn't
    compute an exact number, but Linus's 16x sounds about right). I know
    that the growth of the kernel isn't really linear, but I think the need
    to bump to "13" might not just be decades, but possibly a century or
    more.

    So 12 seems reasonable, and the only downside for it (or for "13", for
    that matter) is a few extra bytes. I dunno, maybe people will really
    hate that, but I have a feeling these are mostly cut-and-pasted anyway.

And this does exactly that.

Keep the tests working by explicitly asking for the old 7 hexdigits
setting in the fake system-wide configuration file used for tests.

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 environment.c        | 2 +-
 t/gitconfig-for-test | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/environment.c b/environment.c
index ca72464..25daddb 100644
--- a/environment.c
+++ b/environment.c
@@ -16,7 +16,7 @@ int trust_executable_bit = 1;
 int trust_ctime = 1;
 int check_stat = 1;
 int has_symlinks = 1;
-int minimum_abbrev = 4, default_abbrev = 7;
+int minimum_abbrev = 4, default_abbrev = 12;
 int ignore_case;
 int assume_unchanged;
 int prefer_symlink_refs;
diff --git a/t/gitconfig-for-test b/t/gitconfig-for-test
index 4598885..8c28442 100644
--- a/t/gitconfig-for-test
+++ b/t/gitconfig-for-test
@@ -4,3 +4,6 @@
 ;; [user]
 ;;	name = A U Thor
 ;;	email = author@xxxxxxxxxxx
+
+[core]
+	abbrev = 7
-- 
2.10.0-584-gc9e068c




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]