dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] force roots to be indexed
Date: Fri, 22 Mar 2024 13:04:52 +0000	[thread overview]
Message-ID: <20240322130453.920208-1-e@80x24.org> (raw)

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

                 reply	other threads:[~2024-03-22 13:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240322130453.920208-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).