- my ($self, $sync, $git, $i, $cmt) = @_;
- my $last = last_epoch_commit($self, $i);
- if (defined $last && is_ancestor($git, $last, $cmt)) {
- my @cmd = (qw(rev-list --count), "$last..$cmt");
- chomp(my $n = $git->qx(@cmd));
+ my ($self, $sync, $stk) = @_;
+ my $unit = $sync->{unit} // return;
+ my $latest_cmt = $stk ? $stk->{latest_cmt} : ${$sync->{latest_cmt}};
+ defined($latest_cmt) or return;
+ my $last = last_epoch_commit($self, $unit->{epoch});
+ if (defined $last && is_ancestor($self->git, $last, $latest_cmt)) {
+ my @cmd = (qw(rev-list --count), "$last..$latest_cmt");
+ chomp(my $n = $unit->{git}->qx(@cmd));