summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorLibravatar Linus Torvalds <torvalds@linux-foundation.org>2016-09-30 17:19:37 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-10-03 12:54:29 -0700
commite6c587c733b4634030b353f4024794b08bc86892 (patch)
tree6ff539da43f3c8030efc7c59d9fb35e9ed167a59 /fast-import.c
parentabbrev: prepare for new world order (diff)
downloadtgif-e6c587c733b4634030b353f4024794b08bc86892.tar.xz
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 'fast-import.c')
0 files changed, 0 insertions, 0 deletions