dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH] force roots to be indexed
@ 2024-03-22 13:04 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2024-03-22 13:04 UTC (permalink / raw)
  To: spew

---
 lib/PublicInbox/CodeSearchIdx.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 41f6b999..244c4e8b 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -480,7 +480,9 @@ sub check_existing { # retry_reopen callback
 }
 
 sub partition_refs ($$$) {
-	my ($self, $git, $refs) = @_; # show-ref --heads --tags --hash output
+	my ($self, $git, $repo) = @_; # show-ref --heads --tags --hash output
+	my $refs = delete $repo->{refs};
+	my @roots = @{$repo->{roots}};
 	sysseek($refs, 0, SEEK_SET);
 	my $rfh = $git->popen(qw(rev-list --stdin), undef, { 0 => $refs });
 	my $seen = 0;
@@ -491,7 +493,7 @@ sub partition_refs ($$$) {
 	} @RDONLY_XDB;
 
 	my $n0 = $NCHANGE;
-	while (defined(my $cmt = <$rfh>)) {
+	while (defined(my $cmt = <$rfh> // shift @roots)) {
 		chomp $cmt;
 		my $n = hex(substr($cmt, 0, 8)) % scalar(@RDONLY_XDB);
 		if ($REINDEX && $REINDEX->set_maybe(pack('H*', $cmt), '')) {
@@ -659,7 +661,7 @@ sub index_repo {
 	}
 	$repo->{roots} = \@roots;
 	local $self->{current_info} = $git->{git_dir};
-	my @shard_in = partition_refs($self, $git, delete($repo->{refs}));
+	my @shard_in = partition_refs($self, $git, $repo);
 	$repo->{git_dir} = $git->{git_dir};
 	my $repo_ctx = $REPO_CTX = { self => $self, repo => $repo };
 	delete $git->{-cidx_gits_fini}; # may fire gits_fini

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-22 13:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-22 13:04 [PATCH] force roots to be indexed Eric Wong

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).