From 881a5493a8c970c10c051cc55d10d2968e71e691 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 19 Sep 2020 09:37:13 +0000 Subject: gcf2: require git dir with OID This amortizes the cost of recreating PublicInbox::Gcf2 objects when alternates change in v2 all.git. --- lib/PublicInbox/Git.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/Git.pm') diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index b49b5bd3..6bb82b6b 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -190,7 +190,8 @@ sub cat_async_step ($$) { $bref = my_read($self->{in}, $rbuf, $size + 1) or fail($self, defined($bref) ? 'read EOF' : "read: $!"); chop($$bref) eq "\n" or fail($self, 'LF missing after blob'); - } elsif ($head =~ / missing$/) { + } elsif ($head =~ s/ missing\n//s) { + $oid = $head; # ref($req) indicates it's already been retried # -gcf2 retries internally, so it never hits this path: if (!ref($req) && !$in_cleanup && $self->alternates_changed) { @@ -198,7 +199,7 @@ sub cat_async_step ($$) { $req, $cb, $arg); } $type = 'missing'; - $oid = ref($req) ? $$req : $req; + $oid = ref($req) ? $$req : $req if $oid eq ''; } else { fail($self, "Unexpected result from async git cat-file: $head"); } -- cgit v1.2.3-24-ge0c7