lib/PublicInbox/Git.pm | 16 ++++++++++++---- diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 2aaf1866b5965169e4abcec87f1fdaed9b6fb47c..9d0f660bae66a2afe63aef644dee08d38b660565 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -339,6 +339,15 @@ utf8::decode($$buf); ($$buf =~ /\r?\n\r?\n([^\r\n]+)\r?\n?/)[0] } +sub extract_cmt_time { + my ($bref, undef, undef, undef, $modified) = @_; + + if ($$bref =~ /^committer .*?> ([0-9]+) [\+\-]?[0-9]+/sm) { + my $cmt_time = $1 + 0; + $$modified = $cmt_time if $cmt_time > $$modified; + } +} + # returns the modified time of a git repo, same as the "modified" field # of a grokmirror manifest sub modified ($) { @@ -346,14 +355,13 @@ my ($self) = @_; my $modified = 0; my $fh = popen($self, qw(rev-parse --branches)); defined $fh or return $modified; + cat_async_begin($self); local $/ = "\n"; foreach my $oid (<$fh>) { chomp $oid; - my $buf = cat_file($self, $oid) or next; - $$buf =~ /^committer .*?> ([0-9]+) [\+\-]?[0-9]+/sm or next; - my $cmt_time = $1 + 0; - $modified = $cmt_time if $cmt_time > $modified; + cat_async($self, $oid, \&extract_cmt_time, \$modified); } + cat_async_wait($self); $modified || time; }