A random discovery today about the Chromium git repository at chromium.googlesource.com/ch… . git varies the length of the short hashes it shows based on an estimate of the repository's size. For Chromium it shows 12-digit short hashes.
2
1
17
It turns out that for the Chromium repository, 12 digits is not enough. There are two revisions in the repo whose initial 12 digits are the same, 72d496d75536. (If it weren't for that pair of revisions, 10 digits would be good enough. But 9 digits has quite a few collisions.)
1
11
(I'm using "git log --format=format:%h" as the definition of what git shows.)
1
(Also, I have a vague sense that git identifies things other than revisions by these hashes as well, so there may be other things I should be examining for collisions. But I'm not that much of a git expert.)

Jun 30, 2021 · 4:00 AM UTC

2
Replying to @davidbaron
Yeah, it's fundamentally just a content-addressable store + Merkel tree. Directory contents, for example, are just objects with a certain format that list filenames and their content hashes.
1
Replying to @davidbaron
All files, folders, and commits use those hashes
1