git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitweb: recognize six digit abbreviated SHA1

From
Sam Vilain <sam@vilain.net>
Date
Jan 13, 2009, 02:00 UTC
Message-ID
<496BF5D7.2090003@vilain.net>
In-Reply-To
<87mydw2hkb.fsf@cup.kalibalik.dk>
Anders Melchiorsen wrote:
Show 11 quoted lines
> Anders Melchiorsen <mail@cup.kalibalik.dk> writes:
>
>   
>> +	if ($line =~ m/([0-9a-fA-F]{7,40})/) {
>>     
>
> I could not make up my mind between the seven digits from "git
> rev-parse --short" and the six digits currently used by gitk.
>
> So I put one option in the patch, and the other one in the subject.
>   

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.

Even git.git isn't unique over 6 digits, even restricting to commits. Not since b0a3de ;-).

Sam
Previous: Anders MelchiorsenNext: Junio C Hamano
Message 3 of 5 in “gitweb: recognize six digit abbreviated SHA1”
  1. gitweb: recognize six digit abbreviated SHA1Anders Melchiorsen, Jan 13, 2009
  2. Anders MelchiorsenJan 13, 2009
  3. Sam VilainJan 13, 2009
  4. Junio C HamanoJan 13, 2009
  5. Sam VilainJan 14, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.