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@xxxxxxxxx> --- Junio C Hamano wrote: >> * "commitdiff_plain" now only generates X-Git-Tag: line only if >> there is tag pointing to the current commit. > > Hmph... > >> ...; besides we are >> interested rather in tags _preceding_ the commit, and _heads_ >> following the commit. > > Interesting observation. When somebody says "feature X was > introduced in such and such commit", people would want to know (1) > the point release they are using has the feature -- which means you > would want to know the earliest tag that comes after the commit, or > (2) if the branch they are working on already has that > feature -- which again means if the head follows the commit. So > I am not sure when preceding tag is interesting... This commit introduces function which does job that was intended I guess for X-Git-Tag: header... perhaps it should be renamed... gitweb/gitweb.perl | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index a068a81..3bc3ff3 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -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 -- 1.4.1.1 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html