+ my $git_dir = $self->{git_dir};
+ require PublicInbox::GitCatFile;
+ my $git = PublicInbox::GitCatFile->new($git_dir);
+ my @cmd = ('git', "--git-dir=$git_dir", "log",
+ qw/--reverse --no-notes --no-color --raw -r --no-abbrev/,
+ $range);
+ my $latest;
+ my $pid = open(my $log, '-|', @cmd) or
+ die('open` '.join(' ', @cmd) . " pipe failed: $!\n");
+ while (my $line = <$log>) {
+ if ($line =~ /$addmsg/o) {
+ $add_cb->($self, $git, $1);
+ } elsif ($line =~ /$delmsg/o) {
+ $del_cb->($self, $git, $1);
+ } elsif ($line =~ /^commit ($h40)/o) {
+ $latest = $1;
+ }
+ }
+ close $log;
+ $latest;
+}
+
+# indexes all unindexed messages
+sub _index_sync {
+ my ($self, $head) = @_;
+ my $db = $self->{xdb};