+# The last git commit we indexed with Xapian or SQLite (msgmap)
+# This needs to account for cases where Xapian or SQLite is
+# out-of-date with respect to the other.
+sub _last_x_commit {
+ my ($self, $mm) = @_;
+ my $lm = $mm->last_commit || '';
+ my $lx = '';
+ if (need_xapian($self)) {
+ $lx = $self->{xdb}->get_metadata('last_commit') || '';
+ } else {
+ $lx = $lm;
+ }
+ # Use last_commit from msgmap if it is older or unset
+ if (!$lm || ($lx && $lm && is_ancestor($self->{git}, $lm, $lx))) {
+ $lx = $lm;
+ }
+ $lx;
+}
+
+sub reindex_from ($$) {
+ my ($reindex, $last_commit) = @_;
+ return $last_commit unless $reindex;
+ ref($reindex) eq 'HASH' ? $reindex->{from} : '';
+}
+