summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2012-07-25 15:03:37 -0500
committerNeil Moore <neil@s-z.org>2012-07-25 15:03:37 -0500
commitc256ddc4dd6c4150fe6e80c0dc2e9e13a66866f8 (patch)
treeedefd20ef31bd4c35ee2864412a423d7c64ac5e5
parent08658be1650dfb4c7f21b162d52d06ebc6ad61af (diff)
downloadcrawlbot-c256ddc4dd6c4150fe6e80c0dc2e9e13a66866f8.tar.gz
crawlbot-c256ddc4dd6c4150fe6e80c0dc2e9e13a66866f8.zip
Include "git describe" version string in %git output.
-rw-r--r--lib/Crawl/Bot/Plugin/Commit.pm13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Crawl/Bot/Plugin/Commit.pm b/lib/Crawl/Bot/Plugin/Commit.pm
index 8867aac..238f234 100644
--- a/lib/Crawl/Bot/Plugin/Commit.pm
+++ b/lib/Crawl/Bot/Plugin/Commit.pm
@@ -61,7 +61,9 @@ sub said {
my $abbr = substr($commit->{hash}, 0, 12);
my $pl = ($commit->{nfiles} == 1 ? "" : "s");
- $self->say(@keys, "$commit->{author} * r$abbr: $commit->{subject} "
+ my $rev = $commit->{revname} || "r$abbr";
+
+ $self->say(@keys, "$commit->{author} * $rev: $commit->{subject} "
. "($commit->{date}, $commit->{nfiles} file$pl, "
. "$commit->{nins}+ $commit->{ndel}-) "
. "https://gitorious.org/crawl/crawl/commit/$abbr"
@@ -130,6 +132,14 @@ sub parse_commit {
my $info = <F>;
CORE::close(F) or return undef;
+ my $revname;
+
+ if (CORE::open(F, "-|:encoding(UTF-8)", qw(git describe), $rev)) {
+ $revname = <F>;
+ $revname =~ s/\n.*//;
+ CORE::close(F);
+ }
+
$info =~ /(.*?)\x00(.*?)\x00(.*?)\x00(.*?)\x00(.*?)\x00(.*)/s or return undef;
my ($hash, $author, $subject, $body, $date, $stat) = ($1, $2, $3, $4, $5, $6);
@@ -146,6 +156,7 @@ sub parse_commit {
nfiles => $nfiles,
nins => $nins,
ndel => $ndel,
+ revname => $revname,
};
}