]> Sergey Matveev's repositories - public-inbox.git/commitdiff
searchidx: log2stack: simplify callers
authorEric Wong <e@80x24.org>
Tue, 27 Oct 2020 07:54:25 +0000 (07:54 +0000)
committerEric Wong <e@80x24.org>
Sat, 7 Nov 2020 10:18:57 +0000 (10:18 +0000)
Since we store {ibx} in $sync state, we no longer have to
pass it as an argument to log2stack.

lib/PublicInbox/SearchIdx.pm
lib/PublicInbox/V2Writable.pm

index d3c904c761db3f3378cdb409095c824a9593d4bb..33c81ea87d4135a6f320c46e41993b1b8ad4de57 100644 (file)
@@ -736,11 +736,11 @@ sub process_stack {
        v1_checkpoint($self, $sync, $stk);
 }
 
-sub log2stack ($$$$) {
-       my ($sync, $git, $range, $ibx) = @_;
+sub log2stack ($$$) {
+       my ($sync, $git, $range) = @_;
        my $D = $sync->{D}; # OID_BIN => NR (if reindexing, undef otherwise)
        my ($add, $del);
-       if ($ibx->version == 1) {
+       if ($sync->{ibx}->version == 1) {
                my $path = $hex.'{2}/'.$hex.'{38}';
                $add = qr!\A:000000 100644 \S+ ($OID) A\t$path$!;
                $del = qr!\A:100644 000000 ($OID) \S+ D\t$path$!;
@@ -796,7 +796,7 @@ sub prepare_stack ($$) {
                return PublicInbox::IdxStack->new->read_prepare if $?;
        }
        $sync->{D} = $sync->{reindex} ? {} : undef; # OID_BIN => NR
-       log2stack($sync, $git, $range, $sync->{ibx});
+       log2stack($sync, $git, $range);
 }
 
 # --is-ancestor requires git 1.8.0+
index 867e4d2b0556c19ddc45e27f382df9819b93a3a4..a403f22feb2220eaca68b3ea6b58016a7e6b9e0b 100644 (file)
@@ -1051,7 +1051,7 @@ sub sync_prepare ($$$) {
                # because we want NNTP article number gaps from unindexed
                # messages to show up in mirrors, too.
                $sync->{D} //= $sync->{reindex} ? {} : undef; # OID_BIN => NR
-               my $stk = log2stack($sync, $git, $range, $sync->{ibx});
+               my $stk = log2stack($sync, $git, $range);
                my $nr = $stk ? $stk->num_records : 0;
                $pr->("$nr\n") if $pr;
                $sync->{stacks}->[$i] = $stk if $stk;