From: "Jakub Narębski" <jnareb@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>, git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/3] gitweb: Link to 7-character SHA1SUMS in commit messages
Date: Wed, 21 Sep 2016 18:26:17 +0200 [thread overview]
Message-ID: <64389bcb-c6e4-1d19-54a1-650868b9acb5@gmail.com> (raw)
In-Reply-To: <20160921114428.28664-2-avarab@gmail.com>
W dniu 21.09.2016 o 13:44, Ævar Arnfjörð Bjarmason napisał:
> Subject: [PATCH 2/3] gitweb: Link to 7-character SHA1SUMS in commit messages
This is modification of a feature, not a new feature it sounds like.
I think the following title / subject would be better:
Subject: [PATCH 2/3] gitweb: Link to 7-char+ SHA1s, not only 8-char+
>
> Change the minimum length of a commit we'll link to from 8 to 7.
I think it would read better as:
Change the minimum length of an abbreviated object identifier in the
commit message gitweb tries to turn into link from 8 hexchars to 7.
>
> This arbitrary minimum length of 8 was introduced in
> v1.4.4.2-151-gbfe2191, but as seen in e.g. v1.7.4-1-gdce9648 the
> default abbreviation length is 7.
Right. I wonder why it was 8 in gitweb...
>
> It's still possible to reference SHA1s down to 4 characters in length,
> see v1.7.4-1-gdce9648's MINIMUM_ABBREV, but I can't see how to make
> git actually produce that, so I doubt anyone is putting that into log
> messages in practice, but people definitely do put 7 character SHA1s
> into log messages.
There is an additional problem: the shorter SHA1 abbrev we try to
match, the more possibility of false positives, words that only look
like (shortened SHA-1).
For 7 characters there is at last one word that can be mistaken
for SHA1 abbrev, namely 'deedeed' (hopefully rare in commit messages).
For 6 characters we have 'accede', 'beaded', 'decade' (!), 'deface',
'facade' (!!), and possibly more (and of course all 7 character
hexdigit words).
Also, the number of digits provided as an optional parameter to
--abbrev or --abbrev-commit options is only a minimal number of
hexdigits: Git would use as many as needed for the abbreviated SHA-1
to be unambiguous, at current time.
I think allowing 7-character shortened SHA-1, which is what Git
produces for smaller repositories by default is (might be?) a good
idea. Thanks for the patch.
>
> I think it's fairly dubious to link to things matching [0-9a-fA-F]
> here as opposed to just [0-9a-f], that dates back to the initial
> version of gitweb from 161332a. Git will accept all-caps SHA1s, but
> didn't ever produce them as far as I can tell.
All right, thanks for reminder.
Signoff?
> ---
> gitweb/gitweb.perl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 9473daf..101dbc0 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -2036,7 +2036,7 @@ sub format_log_line_html {
> my $line = shift;
>
> $line = esc_html($line, -nbsp=>1);
> - $line =~ s{\b([0-9a-fA-F]{8,40})\b}{
> + $line =~ s{\b([0-9a-fA-F]{7,40})\b}{
> $cgi->a({-href => href(action=>"object", hash=>$1),
> -class => "text"}, $1);
> }eg;
>
Nice and simple.
P.S. I have reworking of commit message parsing and enhancement in my
long, long and dated gitweb TODO list :-(
P.P.S. Kay Sievers no longer works on gitweb, and I think no longer
works at SuSE but at RedHat.
Best,
--
Jakub Narębski
next prev parent reply other threads:[~2016-09-21 16:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-21 11:44 [PATCH 1/3] gitweb: Fix an ancient typo in v1.7.7-rc1-1-g0866786 Ævar Arnfjörð Bjarmason
2016-09-21 11:44 ` [PATCH 2/3] gitweb: Link to 7-character SHA1SUMS in commit messages Ævar Arnfjörð Bjarmason
2016-09-21 16:26 ` Jakub Narębski [this message]
2016-09-21 18:04 ` Ævar Arnfjörð Bjarmason
2016-09-21 18:28 ` Jakub Narębski
2016-09-21 20:09 ` Ævar Arnfjörð Bjarmason
2016-09-21 11:44 ` [PATCH 3/3] gitweb: Link to "git describe"'d commits in log messages Ævar Arnfjörð Bjarmason
2016-09-21 16:50 ` Junio C Hamano
2016-09-21 17:49 ` Jakub Narębski
2016-09-21 18:01 ` Junio C Hamano
2016-09-21 17:09 ` Jakub Narębski
2016-09-21 17:58 ` Ævar Arnfjörð Bjarmason
2016-09-21 19:13 ` Jakub Narębski
2016-09-21 13:33 ` [PATCH 1/3] gitweb: Fix an ancient typo in v1.7.7-rc1-1-g0866786 Jakub Narębski
2016-09-21 14:17 ` Ævar Arnfjörð Bjarmason
2016-09-21 17:14 ` Jakub Narębski
2016-09-21 17:17 ` Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=64389bcb-c6e4-1d19-54a1-650868b9acb5@gmail.com \
--to=jnareb@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).