Re: Distribution of longest common hash prefixes

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: Distribution of longest common hash prefixes

From: Randal L. Schwartz <hidden>
Date: 2016-06-15 22:43:02

quoted
quoted
quoted
quoted
"James" == James Cloos [off-list ref] writes:
James> With that version the kernel gives:

James> 0: 
James> 1: 
James> 2: 
James> 3: 565
James> 4: 288450
James> 5: 139080
James> 6: 10699
James> 7: 700
James> 8: 32
James> 9: 2

Fascinating.  So you can spell out *any* commit in linux-2.6.git with
10 hex chars.  What do we need 40 for, again? :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[off-list ref] <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Re: Distribution of longest common hash prefixes

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:43:02

"Randal L. Schwartz" [off-list ref] wrote:
quoted
quoted
quoted
quoted
quoted
"James" == James Cloos [off-list ref] writes:
James> With that version the kernel gives:

James> 0: 
James> 1: 
James> 2: 
James> 3: 565
James> 4: 288450
James> 5: 139080
James> 6: 10699
James> 7: 700
James> 8: 32
James> 9: 2

Fascinating.  So you can spell out *any* commit in linux-2.6.git with
10 hex chars.  What do we need 40 for, again? :)
Well, the other thing is those 2 commits at 9 bytes probably were
not that way a year ago.  One of those might have only needed 8,
and the other is newer, so now you need 9.

What the above tells me is that 8 is almost a safe default for our
abbreviations, but isn't safe enough, as there are collisions past 8.

-- 
Shawn.

Re: Distribution of longest common hash prefixes

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:02


On Tue, 3 Apr 2007, Shawn O. Pearce wrote:
Well, the other thing is those 2 commits at 9 bytes probably were
not that way a year ago.  One of those might have only needed 8,
and the other is newer, so now you need 9.
Well, neither of the the two objects at 9 bytes may not be (and probably 
aren't) commits and of the 32 8-nibble cases who knows how many are 
actually commits (probably none), so an 8-byte SHA1 is *probably* unique 
at least if you just look at commits.

Remove the "--objects" to find out.
What the above tells me is that 8 is almost a safe default for our
abbreviations, but isn't safe enough, as there are collisions past 8.
Yeah, the short SHA1 form is obviously always going to be risky. But in 
practice, since people almost always use it just for commits, it's 
probably good enough in practice, and even if you get a collision in 8 
nibbles, most of the time it will probably be trivial to figure out which 
one was meant, so it's not like it's a disaster if somebody ends up 
reporting a bug with a non-unique abbreviation.

		Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help