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

Re: [PATCH] gitweb: make HTML links out of http/https URLs in changelogs

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 21, 2006, 22:28 UTC
Message-ID
<ejvuf4$4v4$1@sea.gmane.org>
In-Reply-To
<4563777C.4050108@openvz.org>
Kir Kolyshkin wrote:
Show 5 quoted lines
> It is a common practice to put links to bugzillas, mailing lists, etc. 
> in git log entries. The fact that gitweb doesn't make HTML links out of 
> that URLs makes following those URLs inconvenient. This patch fixes that 
> problem, trying to address cases when URL is enclosed in round or square 
> brackets.

Preliminary committags support was sent as an RFC patch on git mailing list once. Hyperlinking plain text http, https, ftp, ftps links etc. is a special case of committag. That wha is implemented now, namely hyperlinking commitsha to commit view is also special case of comittag.

And I plan to implement it, only later. But you are welcome to do it instead.

gitweb-xmms2 http://git.xmms.se/?p=gitweb-xmms2.git has xmms2 related
committags support (links to xmms2 Mantis bugtracker from BUG(n) and
FEATURE(n))
 
Show 10 quoted lines
> Slightly tested on http://git.openvz.org/. Applicable to git-1.4.4.
> 
> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
> ---
>  gitweb/gitweb.perl |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- git-1.4.4/gitweb/gitweb.perl      2006-11-15 08:22:27.000000000 +0100
> +++ git-1.4.4-my/gitweb/gitweb.perl   2006-11-21 22:49:14.000000000 +0100
> @@ -828,6 +828,8 @@

Could you please send patches created by git tools, namely git-format-patch, or if you really need to send GNU diff patches, use -p option? It really helps in patch review.

Show 7 quoted lines
>                       $line =~ s/$hash_text/$link/;
>               }
>       }
> +     # make HTML links out of http(s) URLs
> +     $line =~ s/(http[s]?:\/\/[^[:space:]\]\)]+)/<a href="\1">\1<\/a>/g;
>       return $line;
>  }
Wont work correctly if commit message has sha1 of commit in it; it would be
changed to 
 <a href="$my_uri?p=$project;a=commit;h=$hash_text" class="text">$hash_text</a>
then the code you added will add hyperlink in place of href value (!).
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Kir KolyshkinNext: Randal L. Schwartz
Message 2 of 6 in “gitweb: make HTML links out of http/https URLs in changelogs”
  1. gitweb: make HTML links out of http/https URLs in changelogsKir Kolyshkin, Nov 21, 2006
  2. Jakub NarebskiNov 21, 2006
  3. Randal L. SchwartzNov 21, 2006
  4. Petr BaudisNov 22, 2006
  5. Kir KolyshkinNov 22, 2006
  6. Petr BaudisNov 22, 2006

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.