diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-30 17:19:37 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-03 12:54:29 -0700 |
commit | e6c587c733b4634030b353f4024794b08bc86892 (patch) | |
tree | 6ff539da43f3c8030efc7c59d9fb35e9ed167a59 /environment.c | |
parent | 7b5b7721affae7040cac77d647a5ec8628f0f845 (diff) | |
download | git-e6c587c733b4634030b353f4024794b08bc86892.tar.gz |
abbrev: auto size the default abbreviationlt/abbrev-auto
In fairly early days we somehow decided to abbreviate object names
down to 7-hexdigits, but as projects grow, it is becoming more and
more likely to see such a short object names made in earlier days
and recorded in the log messages no longer unique.
Currently the Linux kernel project needs 11 to 12 hexdigits, while
Git itself needs 10 hexdigits to uniquely identify the objects they
have, while many smaller projects may still be fine with the
original 7-hexdigit default. One-size does not fit all projects.
Introduce a mechanism, where we estimate the number of objects in
the repository upon the first request to abbreviate an object name
with the default setting and come up with a sane default for the
repository. Based on the expectation that we would see collision in
a repository with 2^(2N) objects when using object names shortened
to first N bits, use sufficient number of hexdigits to cover the
number of objects in the repository. Each hexdigit (4-bits) we add
to the shortened name allows us to have four times (2-bits) as many
objects in the repository.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'environment.c')
-rw-r--r-- | environment.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/environment.c b/environment.c index 44fb107b8a..6f9d290563 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 = FALLBACK_DEFAULT_ABBREV; +int minimum_abbrev = 4, default_abbrev = -1; int ignore_case; int assume_unchanged; int prefer_symlink_refs; |