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

Re: [PATCH] gitweb : disambiguate heads and tags withs the same name

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 30, 2007, 18:19 UTC
Message-ID
<7v3avsmpmj.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<e877c31c0710280612l5d783ab0o50ce00c70b3311db@mail.gmail.com>
"Guillaume Seguin" <guillaume@segu.in> writes:
Show 34 quoted lines
> Avoid wrong disambiguation that would link logs/trees of tags and heads which
> share the same name to the same page, leading to a disambiguation that would
> prefer the tag, thus making it impossible to access the corresponding
> head log and
> tree without hacking the url by hand.
>
> ---
>  gitweb/gitweb.perl |   14 ++++++++------
>  1 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 48e21da..f918c00 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -3534,6 +3534,7 @@ sub git_tags_body {
>  	for (my $i = $from; $i <= $to; $i++) {
>  		my $entry = $taglist->[$i];
>  		my %tag = %$entry;
> +		my $name = "refs/tags/$tag{'name'}";
>  		my $comment = $tag{'subject'};
>  		my $comment_short;
>  		if (defined $comment) {
> @@ -3570,8 +3571,8 @@ sub git_tags_body {
>  		      "<td class=\"link\">" . " | " .
>  		      $cgi->a({-href => href(action=>$tag{'reftype'},
> hash=>$tag{'refid'})}, $tag{'reftype'});
>  		if ($tag{'reftype'} eq "commit") {
> -			print " | " . $cgi->a({-href => href(action=>"shortlog",
> hash=>$tag{'name'})}, "shortlog") .
> -			      " | " . $cgi->a({-href => href(action=>"log",
> hash=>$tag{'name'})}, "log");
> +			print " | " . $cgi->a({-href => href(action=>"shortlog",
> hash=>$name)}, "shortlog") .
> ...

Just in case anybody is wondering, the patch is whitespace mangled and lacks a sign-off.

I suspect what the patch does may be a good idea, although I haven't followed the existing code closely to verify it.

Previous: Guillaume SeguinNext: Guillaume Seguin
Message 2 of 3 in “gitweb : disambiguate heads and tags withs the same name”
  1. gitweb : disambiguate heads and tags withs the same nameGuillaume Seguin, Oct 28, 2007
  2. Junio C HamanoOct 30, 2007
  3. gitweb : disambiguate heads and tags withs the same nameGuillaume Seguin, Nov 3, 2007

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.