diff options
Diffstat (limited to 'lib/LXRng/Repo/Git.pm')
-rw-r--r-- | lib/LXRng/Repo/Git.pm | 12 |
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 { |