{"thread":{"id":"17130","subject":"[PATCH] gitweb: recognize six digit abbreviated SHA1","startedAt":"2009-01-13T00:04:40Z","lastAt":"2009-01-14T00:33:33Z","messageCount":5,"participants":["Anders Melchiorsen","Sam Vilain","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"100199","messageId":"87mydw2hrb.fsf@cup.kalibalik.dk","threadId":"17130","inReplyTo":null,"subject":"[PATCH] gitweb: recognize six digit abbreviated SHA1","fromName":"Anders Melchiorsen","fromEmail":"mail@cup.kalibalik.dk","sentAt":"2009-01-13T00:04:40Z","receivedAt":"2009-01-13T00:04:40Z","isPatch":true,"sender":{"key":"mail@cup.kalibalik.dk","avatar":null},"body":"This lets gitweb hightlight abbreviated hashes as produced by\ngit rev-parse --short.\n\nSigned-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>\n---\n\nIt seems like seven digit hashes are in vogue now. So, did I miss some\nreason for keeping it at eight in this spot?\n\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 0ac84d1..1a7d448 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1337,7 +1337,7 @@ sub format_log_line_html {\n \tmy $line = shift;\n \n \t$line = esc_html($line, -nbsp=>1);\n-\tif ($line =~ m/([0-9a-fA-F]{8,40})/) {\n+\tif ($line =~ m/([0-9a-fA-F]{7,40})/) {\n \t\tmy $hash_text = $1;\n \t\tmy $link =\n \t\t\t$cgi->a({-href => href(action=>\"object\", hash=>$hash_text),\n-- \n1.6.0.2.514.g23abd3\n"},{"id":"100200","messageId":"87mydw2hkb.fsf@cup.kalibalik.dk","threadId":"17130","inReplyTo":"87mydw2hrb.fsf@cup.kalibalik.dk","subject":"Re: [PATCH] gitweb: recognize six digit abbreviated SHA1","fromName":"Anders Melchiorsen","fromEmail":"mail@cup.kalibalik.dk","sentAt":"2009-01-13T00:08:52Z","receivedAt":"2009-01-13T00:08:52Z","isPatch":true,"sender":{"key":"mail@cup.kalibalik.dk","avatar":null},"body":"Anders Melchiorsen <mail@cup.kalibalik.dk> writes:\n\n> +\tif ($line =~ m/([0-9a-fA-F]{7,40})/) {\n\nI could not make up my mind between the seven digits from \"git\nrev-parse --short\" and the six digits currently used by gitk.\n\nSo I put one option in the patch, and the other one in the subject.\n\n\nCheers,\nAnders.\n"},{"id":"100219","messageId":"496BF5D7.2090003@vilain.net","threadId":"17130","inReplyTo":"87mydw2hkb.fsf@cup.kalibalik.dk","subject":"Re: [PATCH] gitweb: recognize six digit abbreviated SHA1","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2009-01-13T02:00:55Z","receivedAt":"2009-01-13T02:00:55Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Anders Melchiorsen wrote:\n> Anders Melchiorsen <mail@cup.kalibalik.dk> writes:\n>\n>   \n>> +\tif ($line =~ m/([0-9a-fA-F]{7,40})/) {\n>>     \n>\n> I could not make up my mind between the seven digits from \"git\n> rev-parse --short\" and the six digits currently used by gitk.\n>\n> So I put one option in the patch, and the other one in the subject.\n>   \n\nI think if you're going to go so short as 6 digits, it's probably worth\nmaking sure that the really short SHA1s check commits only. eg, if\nyou've got a commit 'fa023473' and a tree 'fa023421', then 'fa0234'\nshould match the commit and not the tree. But I don't think there's a\nplumbing way to do a query like that at the moment.\n\nEven git.git isn't unique over 6 digits, even restricting to commits.\nNot since b0a3de ;-).\n\nSam\n"},{"id":"100252","messageId":"7vd4erd32a.fsf@gitster.siamese.dyndns.org","threadId":"17130","inReplyTo":"496BF5D7.2090003@vilain.net","subject":"Re: [PATCH] gitweb: recognize six digit abbreviated SHA1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-13T08:26:37Z","receivedAt":"2009-01-13T08:26:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Vilain <sam@vilain.net> writes:\n\n> I think if you're going to go so short as 6 digits, it's probably worth\n> making sure that the really short SHA1s check commits only. eg, if\n> you've got a commit 'fa023473' and a tree 'fa023421', then 'fa0234'\n> should match the commit and not the tree. But I don't think there's a\n> plumbing way to do a query like that at the moment.\n\nWhen people give an abbreviated object name, 99% of the time they mean\ncommits (and \"index deadbeef..acebead\" in a patch is a good place to pick\nblob object names from, which would be what the 99% of the remaining 1%\nwould name), so making sure it is a commit or a blob would be a very\nsensible thing to do.\n\nUnfortunately, you fundamentally cannot do this without taking a\nperformance hit of actually opening the object.\n"},{"id":"100346","messageId":"496D32DD.9010303@vilain.net","threadId":"17130","inReplyTo":"7vd4erd32a.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] gitweb: recognize six digit abbreviated SHA1","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2009-01-14T00:33:33Z","receivedAt":"2009-01-14T00:33:33Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> When people give an abbreviated object name, 99% of the time they mean\n> commits (and \"index deadbeef..acebead\" in a patch is a good place to pick\n> blob object names from, which would be what the 99% of the remaining 1%\n> would name), so making sure it is a commit or a blob would be a very\n> sensible thing to do.\n>\n> Unfortunately, you fundamentally cannot do this without taking a\n> performance hit of actually opening the object.\n>   \n\nYeah. I envisioned this just for those cases where the tool would\notherwise return 'ambiguous argument'; if there was a hint as to the\nobject type, open *all* the matching objects and return the one that\nmatched the type only.\n\nSam.\n"}]}