From: Junio C Hamano Date: Tue, 13 Jan 2009 08:26:37 GMT Subject: Re: [PATCH] gitweb: recognize six digit abbreviated SHA1 Message-ID: <7vd4erd32a.fsf@gitster.siamese.dyndns.org> In-Reply-To: <496BF5D7.2090003@vilain.net> Sam Vilain writes: > I think if you're going to go so short as 6 digits, it's probably worth > making sure that the really short SHA1s check commits only. eg, if > you've got a commit 'fa023473' and a tree 'fa023421', then 'fa0234' > should match the commit and not the tree. But I don't think there's a > plumbing way to do a query like that at the moment. When people give an abbreviated object name, 99% of the time they mean commits (and "index deadbeef..acebead" in a patch is a good place to pick blob object names from, which would be what the 99% of the remaining 1% would name), so making sure it is a commit or a blob would be a very sensible thing to do. Unfortunately, you fundamentally cannot do this without taking a performance hit of actually opening the object.