summaryrefslogtreecommitdiff
path: root/builtin/rev-parse.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-01 00:19:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-10-03 19:54:29 (GMT)
commite6c587c733b4634030b353f4024794b08bc86892 (patch)
tree6ff539da43f3c8030efc7c59d9fb35e9ed167a59 /builtin/rev-parse.c
parent7b5b7721affae7040cac77d647a5ec8628f0f845 (diff)
downloadgit-e6c587c733b4634030b353f4024794b08bc86892.zip
git-e6c587c733b4634030b353f4024794b08bc86892.tar.gz
git-e6c587c733b4634030b353f4024794b08bc86892.tar.bz2
abbrev: auto size the default abbreviation
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 'builtin/rev-parse.c')
0 files changed, 0 insertions, 0 deletions