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

Re: [PATCH v2 3/3] gitweb: Link to "git describe"'d commits in log messages

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 14, 2016, 19:00 UTC
Message-ID
<xmqqvawuycv0.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CACBZZX4HPci=n193WPm1RCes4PZfFXQtAdJuwxMwvTvF2NBVMA@mail.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 11 quoted lines
> I just ran into an example of a better reason for doing it like my
> patch is doing, which is that if you have some tag like:
>
> deployment-20160928-171914-16-g42e13d8
>
> With my patch the whole thing will be a link to the 42e13d8 commit,
> but with this suggestion both 20160928 and 42e13d8 would become commit
> links, the former one would be broken.
>
> Of course we could have some code that would detect that the whole \S+
> is part of one thing that ends in g<commit>,...

I think that this example shows a flaw not in the "suffix that looks like an object name" approach, but more in the boundary regexp, namely, the \b part; it is probably too loose.

And \S+ is not the right cue, either, for that matter. IOW, "we only should take hexstring, optionally prefixed with 'g', that appears before the whitespace" is too strict, as a sentence

    We broke the system with deployment-g42e13d8.

does want to link to 42e13d8, even though full-stop at the end is not whitespace, and the existing regexp uses \b there as a rough equivalent to saying "Here must be a whitespace or punctuation".

An attempt to tighten "what a punctuation is" by excluding '-' may make that "timestamp is in the tagname" example work, but is not a good solution, either, because two sentences can be concatenated with an em-dash that is often typed as two hyphen in plain text, resulting in something like

    We broke the system with deployment-g42e13d8--sigh.
and we do want to treat the '-' after 42e13d8 as a punctuation after
a described object name.
    
So I agree 3/3 is good thing to do as-is.
Thanks.
Previous: Ævar Arnfjörð BjarmasonNext: Jakub Narębski
Message 8 of 16 in “gitweb: Be smarter about linking to SHA1s in log messages”
  1. 0/3 gitweb: Be smarter about linking to SHA1s in log messagesÆvar Arnfjörð Bjarmason, Oct 6, 2016
  2. 1/3 gitweb: Fix a typo in a commentÆvar Arnfjörð Bjarmason, Oct 6, 2016
  3. Jakub NarębskiOct 14, 2016
  4. 3/3 gitweb: Link to "git describe"'d commits in log messagesÆvar Arnfjörð Bjarmason, Oct 6, 2016
  5. Junio C HamanoOct 6, 2016
  6. Ævar Arnfjörð BjarmasonOct 9, 2016
  7. Ævar Arnfjörð BjarmasonOct 14, 2016
  8. Junio C HamanoOct 14, 2016
  9. Jakub NarębskiOct 14, 2016
  10. 2/3 gitweb: Link to 7-char+ SHA1s, not only 8-char+Ævar Arnfjörð Bjarmason, Oct 6, 2016
  11. Junio C HamanoOct 6, 2016
  12. Jakub NarębskiOct 14, 2016
  13. Junio C HamanoOct 14, 2016
  14. Ævar Arnfjörð BjarmasonOct 15, 2016
  15. Junio C HamanoOct 17, 2016
  16. Ævar Arnfjörð BjarmasonOct 17, 2016

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.