diff options
author | Eric Wong <e@80x24.org> | 2015-08-18 06:23:06 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-08-20 04:00:11 +0000 |
commit | 88c732d8af5dde98fbf1af611bf4865b0534093c (patch) | |
tree | c532470bfcf738fab61c35aaefbc8d83bdb9ea07 /lib | |
parent | 506b57e6f76888cbc930cd401af6d9e9ed87eb0f (diff) | |
download | public-inbox-88c732d8af5dde98fbf1af611bf4865b0534093c.tar.gz |
This should allow us to sync the index to a temporary head to update the Xapian index before we update the real HEAD index.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/Search.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index abd9db4c..d9e5fd1f 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -541,20 +541,21 @@ sub enquire { # indexes all unindexed messages sub index_sync { - my ($self) = @_; + my ($self, $head) = @_; require PublicInbox::GitCatFile; my $db = $self->{xdb}; my $hex = '[a-f0-9]'; my $h40 = $hex .'{40}'; my $addmsg = qr!^:000000 100644 \S+ ($h40) A\t${hex}{2}/${hex}{38}$!; my $delmsg = qr!^:100644 000000 ($h40) \S+ D\t${hex}{2}/${hex}{38}$!; + $head ||= 'HEAD'; $db->begin_transaction; eval { my $git = PublicInbox::GitCatFile->new($self->{git_dir}); my $latest = $db->get_metadata('last_commit'); - my $range = length $latest ? "$latest..HEAD" : 'HEAD'; + my $range = length $latest ? "$latest..$head" : $head; $latest = undef; # get indexed messages |