From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: [PATCH] gitweb : disambiguate heads and tags withs the same name Date: Tue, 30 Oct 2007 11:19:48 -0700 Message-ID: <7v3avsmpmj.fsf@gitster.siamese.dyndns.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: pasky@ucw.cz, git@vger.kernel.org To: "Guillaume Seguin" X-From: git-owner@vger.kernel.org Tue Oct 30 19:20:10 2007 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1ImvhB-0006Pw-JK for gcvg-git-2@gmane.org; Tue, 30 Oct 2007 19:20:10 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753121AbXJ3ST4 (ORCPT ); Tue, 30 Oct 2007 14:19:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753120AbXJ3ST4 (ORCPT ); Tue, 30 Oct 2007 14:19:56 -0400 Received: from sceptre.pobox.com ([207.106.133.20]:43369 "EHLO sceptre.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753111AbXJ3STz (ORCPT ); Tue, 30 Oct 2007 14:19:55 -0400 Received: from sceptre (localhost.localdomain [127.0.0.1]) by sceptre.pobox.com (Postfix) with ESMTP id 199932FA; Tue, 30 Oct 2007 14:20:16 -0400 (EDT) Received: from pobox.com (ip68-225-240-77.oc.oc.cox.net [68.225.240.77]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by sceptre.sasl.smtp.pobox.com (Postfix) with ESMTP id 7E6299058C; Tue, 30 Oct 2007 14:20:12 -0400 (EDT) In-Reply-To: (Guillaume Seguin's message of "Sun, 28 Oct 2007 14:12:53 +0100") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: "Guillaume Seguin" writes: > 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 { > "" . " | " . > $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.