From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2A26C1F44D for ; Fri, 22 Mar 2024 13:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1711112693; bh=M8+79suSmO/PnTdcM1y6FP0bqEcW3u95T0zA555KUGg=; h=From:To:Subject:Date:From; b=2KD36kDIpnJn+Gu/6tTsciW+RV7HF4KQL56X90aXJGMjwJ25jqn8CcbnOnJtREgVl wNZwCuXaThC5iuIAPCSgncGiSPrUl8GcozIvGh9LJH76B+9C3kUyKho8tizWPO40ko 3VtZ9vUYlnWK5Mj+kj9xzRSNpgKunaYhrAIA/L9Y= From: Eric Wong To: spew@80x24.org Subject: [PATCH] force roots to be indexed Date: Fri, 22 Mar 2024 13:04:52 +0000 Message-ID: <20240322130453.920208-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: --- 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