about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/Git.pm13
-rw-r--r--lib/PublicInbox/RepoSnapshot.pm2
-rw-r--r--lib/PublicInbox/RepoTree.pm2
-rw-r--r--lib/PublicInbox/SearchIdx.pm7
-rw-r--r--lib/PublicInbox/V2Writable.pm1
5 files changed, 11 insertions, 14 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 61ba8aa1..764e38d7 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -299,13 +299,8 @@ sub cat_async_step ($$) {
         }
         $self->{rbuf} = $rbuf if $$rbuf ne '';
         splice(@$inflight, 0, 3); # don't retry $cb on ->fail
-        if ($info) {
-                eval { $cb->($oid, $type, $size, $arg, $self) };
-                async_err($self, $req, $oid, $@, 'check') if $@;
-        } else {
-                eval { $cb->($bref, $oid, $type, $size, $arg) };
-                async_err($self, $req, $oid, $@, 'cat') if $@;
-        }
+        eval { $cb->($bref, $oid, $type, $size, $arg) };
+        async_err($self, $req, $oid, $@, $info ? 'check' : 'cat') if $@;
 }
 
 sub cat_async_wait ($) {
@@ -357,7 +352,7 @@ sub check_async_step ($$) {
         }
         $self->{rbuf_c} = $rbuf if $$rbuf ne '';
         splice(@$inflight_c, 0, 3); # don't retry $cb on ->fail
-        eval { $cb->($hex, $type, $size, $arg, $self) };
+        eval { $cb->(undef, $hex, $type, $size, $arg) };
         async_err($self, $req, $hex, $@, 'check') if $@;
 }
 
@@ -415,7 +410,7 @@ sub check_async ($$$$) {
 }
 
 sub _check_cb { # check_async callback
-        my ($hex, $type, $size, $result) = @_;
+        my (undef, $hex, $type, $size, $result) = @_;
         @$result = ($hex, $type, $size);
 }
 
diff --git a/lib/PublicInbox/RepoSnapshot.pm b/lib/PublicInbox/RepoSnapshot.pm
index 93ba4db6..ebcbbd81 100644
--- a/lib/PublicInbox/RepoSnapshot.pm
+++ b/lib/PublicInbox/RepoSnapshot.pm
@@ -42,7 +42,7 @@ sub archive_hdr { # parse_hdr for Qspawn
 }
 
 sub ver_check { # git->check_async callback
-        my ($oid, $type, $size, $ctx) = @_;
+        my (undef, $oid, $type, $size, $ctx) = @_;
         return if defined $ctx->{etag};
         my $treeish = shift @{$ctx->{-try}} // die 'BUG: no {-try}';
         if ($type eq 'missing') {
diff --git a/lib/PublicInbox/RepoTree.pm b/lib/PublicInbox/RepoTree.pm
index 25dc5b10..9c7b86b3 100644
--- a/lib/PublicInbox/RepoTree.pm
+++ b/lib/PublicInbox/RepoTree.pm
@@ -62,7 +62,7 @@ sub find_missing {
 }
 
 sub tree_show { # git check_async callback
-        my ($oid, $type, $size, $ctx) = @_;
+        my (undef, $oid, $type, $size, $ctx) = @_;
         return find_missing($ctx) if $type eq 'missing';
 
         my $res = [ $ctx->{git}, $oid, $type, $size ];
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index cfc2d544..61dc7ce3 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -839,10 +839,10 @@ sub index_sync {
 }
 
 sub check_size { # check_async cb for -index --max-size=...
-        my ($oid, $type, $size, $arg, $git) = @_;
-        (($type // '') eq 'blob') or die "E: bad $oid in $git->{git_dir}";
+        my (undef, $oid, $type, $size, $arg) = @_;
+        ($type // '') eq 'blob' or die "E: bad $oid in $arg->{git}->{git_dir}";
         if ($size <= $arg->{max_size}) {
-                $git->cat_async($oid, $arg->{index_oid}, $arg);
+                $arg->{git}->cat_async($oid, $arg->{index_oid}, $arg);
         } else {
                 warn "W: skipping $oid ($size > $arg->{max_size})\n";
         }
@@ -924,6 +924,7 @@ sub process_stack {
                         $arg->{autime} = $at;
                         $arg->{cotime} = $ct;
                         if ($sync->{max_size}) {
+                                $arg->{git} = $git;
                                 $git->check_async($oid, \&check_size, $arg);
                         } else {
                                 $git->cat_async($oid, \&index_both, $arg);
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index ae8d778f..191c5588 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -1160,6 +1160,7 @@ sub index_todo ($$$) {
                 };
                 if ($f eq 'm') {
                         if ($sync->{max_size}) {
+                                $req->{git} = $all;
                                 $all->check_async($oid, \&check_size, $req);
                         } else {
                                 $all->cat_async($oid, $index_oid, $req);