* [PATCH] search: index_sync allows specifying alternate HEAD
@ 2015-08-18 6:23 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2015-08-18 6:23 UTC (permalink / raw)
To: meta
This should allow us to sync the index to a temporary head
to update the Xapian index before we update the real HEAD
index.
---
lib/PublicInbox/Search.pm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 8395e68..2e12020 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
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-08-18 6:23 7% [PATCH] search: index_sync allows specifying alternate HEAD Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).