@matheusbsbs / matheus-bagliano / commits / 56a322f161
Fork 0

gitweb: Add git_get_rev_name_tags function

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 <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Aug 24, 2006 at 19:41 UTC 56a322f16113119bcc3770ef9565297ab59c29d2
1 file changed +16
gitweb/gitweb.perl
+16
@@ -800,6 +800,22 @@ sub git_get_preceding_references {
800 return @reflist;
801 }
802
803 +sub git_get_rev_name_tags {
804 + my $hash = shift || return undef;
805 +
806 + open my $fd, "-|", $GIT, "name-rev", "--tags", $hash
807 + or return;
808 + my $name_rev = <$fd>;
809 + close $fd;
810 +
811 + if ($name_rev =~ m|^$hash tags/(.*)$|) {
812 + return $1;
813 + } else {
814 + # catches also '$hash undefined' output
815 + return undef;
816 + }
817 +}
818 +
819 ## ----------------------------------------------------------------------
820 ## parse to hash functions
821