- if ($mm) {
- $dbh->begin_work;
- my $lm = $mm->last_commit || '';
- if ($lm eq $lx) {
- # Common case is the indexes are synced,
- # we only need to run git-log once:
- rlog($self, $xlog, *index_both, *unindex_both, $cb);
- } else {
- # Uncommon case, msgmap and xapian are out-of-sync
- # do not care for performance (but git is fast :>)
- # This happens if we have to reindex Xapian since
- # msgmap is a frozen format and our Xapian format
- # is evolving.
- my $r = $lm eq '' ? $tip : "$lm..$tip";
-
- # first, ensure msgmap is up-to-date:
- my $mkey_prev = $mkey;
- $mkey = undef; # ignore xapian, for now
- my $mlog = _git_log($self, $r);
- $mm_only = 1;
- rlog($self, $mlog, *index_mm, *unindex_mm, $cb);
- $mm_only = $mlog = undef;
-
- # now deal with Xapian
- $mkey = $mkey_prev;
- $dbh = undef;
- rlog($self, $xlog, *index_mm2, *unindex_mm2, $cb);
- }
- } else {
- # user didn't install DBD::SQLite and DBI
- rlog($self, $xlog, *add_message, *unindex_blob, $cb);
- }
-}
-
-# this will create a ghost as necessary
-sub resolve_mid_to_tid {
- my ($self, $mid) = @_;
- my $tid;
- $self->each_smsg_by_mid($mid, sub {
- my ($smsg) = @_;
- my $cur_tid = $smsg->thread_id;
- if (defined $tid) {
- merge_threads($self, $tid, $cur_tid);
- } else {
- $tid = $smsg->thread_id;
- }
- 1;
- });
- return $tid if defined $tid;
-
- $self->create_ghost($mid)->thread_id;