From: Eric Wong Date: Fri, 10 Jan 2025 23:18:14 +0000 (+0000) Subject: (ext)index: avoid needless {git} ref with --max-size X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6bee92846a55ecccccc56000f05001fa6ebfb7a;p=thirdparty%2Fpublic-inbox.git (ext)index: avoid needless {git} ref with --max-size We can access the PublicInbox::Git object via {ibx} directly to avoid redundant refs and cut down the $sync struct further. --- diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index d2954ed7c..77416e61a 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -850,9 +850,10 @@ sub index_sync { sub check_size { # check_async cb for -index --max-size=... my (undef, $oid, $type, $size, $arg) = @_; - ($type // '') eq 'blob' or die "E: bad $oid in $arg->{git}->{git_dir}"; + ($type // '') eq 'blob' or + die "E: bad $oid in $arg->{ibx}->{git}->{git_dir}"; if ($size <= $arg->{max_size}) { - $arg->{git}->cat_async($oid, $arg->{index_oid}, $arg); + $arg->{ibx}->{git}->cat_async($oid, $arg->{index_oid}, $arg); } else { warn "W: skipping $oid ($size > $arg->{max_size})\n"; } @@ -931,7 +932,6 @@ sub v1_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, \&v1_index_both, $arg); diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 5d8a5484b..27be8c39e 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -1126,7 +1126,7 @@ sub index_todo ($$$) { return if $sync->{quit}; unindex_todo($self, $sync, $unit); my $stk = delete($unit->{stack}) or return; - my $all = $self->git; + my $all = $self->git; # initialize self->{ibx}->{git} my $index_oid = $self->can('index_oid'); my $unindex_oid = $self->can('unindex_oid'); my $pfx; @@ -1155,7 +1155,6 @@ 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);