-sub index_epoch ($$$) {
- my ($self, $sync, $i) = @_;
-
- my $git_dir = git_dir_n($self, $i);
- -d $git_dir or return; # missing epochs are fine
- my $git = PublicInbox::Git->new($git_dir);
- if (my $unindex_range = delete $sync->{unindex_range}->{$i}) { # rare
- unindex($self, $sync, $git, $unindex_range);
- }
- defined(my $stk = $sync->{stacks}->[$i]) or return;
- $sync->{stacks}->[$i] = undef;
- my $all = $self->{ibx}->git;
- while (my ($f, $at, $ct, $oid) = $stk->pop_rec) {
- $self->{current_info} = "$i.git $oid";
+sub index_todo ($$$) {
+ my ($self, $sync, $unit) = @_;
+ return if $sync->{quit};
+ unindex_todo($self, $sync, $unit);
+ my $stk = delete($unit->{stack}) or return;
+ my $all = $self->git;
+ my $index_oid = $self->can('index_oid');
+ my $unindex_oid = $self->can('unindex_oid');
+ my $pfx;
+ if ($unit->{git}->{git_dir} =~ m!/([^/]+)/git/([0-9]+\.git)\z!) {
+ $pfx = "$1 $2"; # v2
+ } else { # v1
+ ($pfx) = ($unit->{git}->{git_dir} =~ m!/([^/]+)\z!g);
+ $pfx //= $unit->{git}->{git_dir};
+ }
+ local $self->{current_info} = "$pfx ";
+ local $sync->{latest_cmt} = \(my $latest_cmt);
+ local $sync->{unit} = $unit;
+ while (my ($f, $at, $ct, $oid, $cmt) = $stk->pop_rec) {
+ my $req = {
+ %$sync,
+ autime => $at,
+ cotime => $ct,
+ oid => $oid,
+ cur_cmt => $cmt
+ };