]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Add git_get_rev_name_tags function
authorJakub Narebski <redacted>
Thu, 24 Aug 2006 17:41:23 +0000 (19:41 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:10 +0000 (00:07 -0400)
Add git_get_rev_name_tags function, for later use in
git_commitdiff('plain') for X-Git-Tag: header.

This function, contrary to the call to
  git_get_following_references($hash, "tags");
_does_ strip "tags/" and returns bare tag name.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 86cc917593bb171bbc3676816045820879bf3bc99673c6ba3b17f09b9b8c7606..e1bc5390693d7f465c9ffb5ebbb8b349d2c58ac59478ce39a98af2f8df361f7b 100755 (executable)
@@ -800,6 +800,22 @@ sub git_get_preceding_references {
        return @reflist;
 }
 
+sub git_get_rev_name_tags {
+       my $hash = shift || return undef;
+
+       open my $fd, "-|", $GIT, "name-rev", "--tags", $hash
+               or return;
+       my $name_rev = <$fd>;
+       close $fd;
+
+       if ($name_rev =~ m|^$hash tags/(.*)$|) {
+               return $1;
+       } else {
+               # catches also '$hash undefined' output
+               return undef;
+       }
+}
+
 ## ----------------------------------------------------------------------
 ## parse to hash functions
 
This page took 0.161788 seconds and 4 git commands to generate.