about summary refs log tree commit homepage
path: root/lib/PublicInbox/Git.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-04-28 21:07:30 +0000
committerEric Wong <e@80x24.org>2023-04-29 06:05:13 +0000
commit847389d8d4012177616e51f0af3151ed8ab58ff3 (patch)
treedb7b1a2fc97af86a658b21bbcf4f4e00d0851686 /lib/PublicInbox/Git.pm
parent0f3b7b6058cc4b667e6fbd967d882ad8c47de288 (diff)
downloadpublic-inbox-847389d8d4012177616e51f0af3151ed8ab58ff3.tar.gz
This simplifies Git->cat_async_step and fixes Git->async_abort,
the latter of which was passing arguments improperly for the
--batch-check (or `info') case at the cost of making the few
check_async callers handle an extra argument.

The extra (PublicInbox::Git) $self argument for check_async
callbacks is now gone, as avoiding the temporary cyclic
reference doesn't seem worthwhile since the temporary cyclic
reference appears in the ->cat_async code paths, too.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r--lib/PublicInbox/Git.pm13
1 files changed, 4 insertions, 9 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);
 }