[PATCH 9] gitweb: Use git_get_name_rev_tags for commitdiff_plain X-Git-Tag: header
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Aug 24, 2006, 17:45 UTC
- Message-ID
- <200608241945.30553.jnareb@gmail.com>
- In-Reply-To
- <200608240015.15071.jnareb@gmail.com>
Use git_get_rev_name_tags function for X-Git-Tag: header in git_commitdiff('plain'), i.e. for commitdiff_plain action.
Signed-off-by: Jakub Narebski <jnareb@gmail.com> --- For example, commitdiff_plain for 6c7f4cebdb40c0d95c63d59538fd235dcf978029 commit -- the following query string: a=commitdiff_plain;p=git.git;h=6c7f4cebdb40c0d95c63d59538fd235dcf978029 outputs the following X-Git-Tag: header: X-Git-Tag: v1.4.2^0~2
gitweb/gitweb.perl | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 3bc3ff3..b2e8259 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2840,10 +2840,7 @@ sub git_commitdiff { } elsif ($format eq 'plain') { my $refs = git_get_references("tags"); - my @tagnames; - if (exists $refs->{$hash}) { - @tagnames = map { s|^tags/|| } $refs->{$hash}; - } + my $tagname = git_get_rev_name_tags($hash); my $filename = basename($project) . "-$hash.patch"; print $cgi->header( @@ -2857,10 +2854,9 @@ From: $co{'author'} Date: $ad{'rfc2822'} ($ad{'tz_local'}) Subject: $co{'title'} TEXT - foreach my $tag (@tagnames) { - print "X-Git-Tag: $tag\n"; - } + print "X-Git-Tag: $tagname\n" if $tagname; print "X-Git-Url: " . $cgi->self_url() . "\n\n"; + foreach my $line (@{$co{'comment'}}) { print "$line\n"; }
-- 1.4.1.1