]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/V2Writable.pm
git: use async_wait_all everywhere
[public-inbox.git] / lib / PublicInbox / V2Writable.pm
index 971b007b02d62e6c62ebe9ca6b536432e874e18e..fcd7ffe2317ba518d06ff3faf3d8328600d4d1a1 100644 (file)
@@ -876,6 +876,11 @@ sub update_last_commit {
                chomp(my $n = $unit->{git}->qx(@cmd));
                return if $n ne '' && $n == 0;
        }
+       # don't rewind if --{since,until,before,after} are in use
+       return if (defined($last) &&
+                       grep(defined, @{$sync->{-opt}}{qw(since until)}) &&
+                       is_ancestor($self->git, $latest_cmt, $last));
+
        last_epoch_commit($self, $unit->{epoch}, $latest_cmt);
 }
 
@@ -1026,7 +1031,7 @@ sub sync_prepare ($$) {
                        my $req = { %$sync, oid => $oid };
                        $self->git->cat_async($oid, $unindex_oid, $req);
                }
-               $self->git->cat_async_wait;
+               $self->git->async_wait_all;
        }
        return 0 if $sync->{quit};
        if (!$regen_max) {
@@ -1108,7 +1113,7 @@ sub unindex_todo ($$$) {
                $self->git->cat_async($1, $unindex_oid, { %$sync, oid => $1 });
        }
        close $fh or die "git log failed: \$?=$?";
-       $self->git->cat_async_wait;
+       $self->git->async_wait_all;
 
        return unless $sync->{-opt}->{prune};
        my $after = scalar keys %$unindexed;
@@ -1240,7 +1245,7 @@ sub xapian_only {
                        index_xap_step($self, $sync, $art_beg, 1);
                }
        }
-       $self->git->cat_async_wait;
+       $self->git->async_wait_all;
        $self->{ibx}->cleanup;
        $self->done;
 }
@@ -1337,7 +1342,8 @@ sub index_sync {
        }
 
        # reindex does not pick up new changes, so we rerun w/o it:
-       if ($opt->{reindex} && !$sync->{quit}) {
+       if ($opt->{reindex} && !$sync->{quit} &&
+                       !grep(defined, @$opt{qw(since until)})) {
                my %again = %$opt;
                $sync = undef;
                delete @again{qw(rethread reindex -skip_lock)};