Re: Distribution of longest common hash prefixes
- From
Junio C Hamano <junkio@cox.net>
- Date
- Apr 3, 2007, 20:25 UTC
- Message-ID
- <7vhcrxw6h5.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <alpine.LFD.0.98.0704031529300.28181@xanadu.home>
Nicolas Pitre <nico@cam.org> writes:
Show 18 quoted lines
> On Tue, 3 Apr 2007, Junio C Hamano wrote: > >> Linus Torvalds <torvalds@linux-foundation.org> writes: >> >> > 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. >> >> Are you hinting to update sha1_name.c::get_sha1() so that we do >> not accept abbreviated non-commit object names? > > NO, I hope not. > > Instead (and if the concern is real) we should error out when the > abbreviated name is ambigous and impose no restriction otherwise.
I stated it wrongly. What I was getting at was that we might want to consider an abbreviation that matches only a single commit unambiguous even when there are ambiguous objects of other kinds.
Not that I consider it a pressing issue, though.