aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Georg Gleditsch <argggh@lxr.linpro.no>2007-11-29 10:09:26 +0100
committerArne Georg Gleditsch <argggh@lxr.linpro.no>2007-11-29 10:09:26 +0100
commitd07a529eec62c374c40df8240ecf11a0c592f160 (patch)
tree80bc6870bc46b65c4fadf0610947a2c87722eae2
parentad39818967f93d3ed60bd5abe59fabe08f88c8ff (diff)
Not all tags are commit objects.
-rw-r--r--lib/LXRng/Repo/Git.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/LXRng/Repo/Git.pm b/lib/LXRng/Repo/Git.pm
index 3619427..261f595 100644
--- a/lib/LXRng/Repo/Git.pm
+++ b/lib/LXRng/Repo/Git.pm
@@ -39,15 +39,21 @@ sub cache_key {
sub _release_timestamp {
my ($self, $release) = @_;
- my $cinfo = $self->_git_cmd('cat-file', 'commit', $release);
+ my $cinfo = $self->_git_cmd('cat-file', '-t', $release);
+ my ($type) = <$cinfo> =~ /(\S+)/;
+
+ return undef unless $type eq 'tag' or $type eq 'commit';
+
+ my $cinfo = $self->_git_cmd('cat-file', $type, $release);
my $time;
while (<$cinfo>) {
$time = $1 if /^author .*? (\d+(?: [-+]\d+|))$/ ;
$time ||= $1 if /^committer .*? (\d+(?: [-+]\d+|))$/ ;
+ $time ||= $1 if /^tagger .*? (\d+(?: [-+]\d+|))$/ ;
}
-
- return $time;
+
+ return $time || 0;
}
sub _use_author_timestamp {