]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git: modified: don't slurp `rev-parse --branches'
authorEric Wong <e@yhbt.net>
Sat, 11 Jan 2020 22:34:56 +0000 (22:34 +0000)
committerEric Wong <e@yhbt.net>
Mon, 13 Jan 2020 04:36:38 +0000 (04:36 +0000)
While v1 inboxes typically only have one branch, code repositories
may have dozens or even hundreds.  Slurping those into memory is
a waste.

lib/PublicInbox/Git.pm

index 8ee04e17b511ca1b7c470aa05ea7ce30f26ac033..0ace907e304896728f8c013c29972b9e3308a6d1 100644 (file)
@@ -347,7 +347,7 @@ sub modified ($) {
        my $fh = popen($self, qw(rev-parse --branches));
        cat_async_begin($self);
        local $/ = "\n";
-       foreach my $oid (<$fh>) {
+       while (my $oid = <$fh>) {
                chomp $oid;
                cat_async($self, $oid, \&extract_cmt_time, \$modified);
        }