From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/3] cindex: quiet --prune when checking objectFormat
Date: Wed, 25 Oct 2023 15:33:48 +0000 [thread overview]
Message-ID: <20231025153349.3247178-3-e@80x24.org> (raw)
In-Reply-To: <20231025153349.3247178-1-e@80x24.org>
Most coderepos don't have extensions.objectFormat set,
so it's senseless to emit warnings on failures.
Fixes: 709fcf00c4d5 (cindex: use run_await to read extensions.objectFormat)
---
lib/PublicInbox/CodeSearchIdx.pm | 3 ++-
t/cindex.t | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index f2fd28e3..80636270 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -858,7 +858,8 @@ sub prep_alternate_start {
}
my $cmd = [ 'git', "--git-dir=$git_dir",
qw(config extensions.objectFormat) ];
- run_await($cmd, undef, undef, \&prep_alternate_end, $o, $run_prune);
+ my $opt = { quiet => 1 };
+ run_await($cmd, undef, $opt, \&prep_alternate_end, $o, $run_prune);
}
sub cmd_done { # run_await cb for sort, xapian-delve, sed failures
diff --git a/t/cindex.t b/t/cindex.t
index c7de1505..09183518 100644
--- a/t/cindex.t
+++ b/t/cindex.t
@@ -13,6 +13,7 @@ my ($tmp, $for_destroy) = tmpdir();
my $pwd = getcwd();
my @unused_keys = qw(last_commit has_threadid skip_docdata);
local $ENV{PI_CONFIG} = '/dev/null';
+my $opt = { 1 => \(my $cidx_out), 2 => \(my $cidx_err) };
# I reworked CodeSearchIdx->shard_worker to handle empty trees
# in the initial commit generated by cvs2svn for xapian.git
@@ -166,7 +167,9 @@ SKIP: { # --prune
is(scalar($csrch->mset('s:hi')->items), 1, 'got hit');
rename("$tmp/wt0/.git", "$tmp/wt0/.giit");
- ok(run_script([qw(-cindex -q --prune -d), "$tmp/ext"]), 'prune');
+ ok(run_script([qw(-cindex -q --prune -d), "$tmp/ext"], undef, $opt),
+ 'prune');
+ is(${$opt->{2}}, '', 'nothing in stderr') or diag explain($opt);
$csrch->reopen;
is(scalar($csrch->mset('s:hi')->items), 0, 'hit pruned');
@@ -213,7 +216,7 @@ EOM
close $fh;
my $cmd = [ qw(-cindex -u --all --associate -d), "$tmp/ext",
'-I', $basic->{inboxdir} ];
- my $opt = { 1 => \(my $cidx_out), 2 => \(my $cidx_err) };
+ $cidx_out = $cidx_err = '';
ok(run_script($cmd, $env, $opt), 'associate w/o search');
like($cidx_err, qr/W: \Q$basic->{inboxdir}\E not indexed for search/,
'non-Xapian-enabled inbox noted');
next prev parent reply other threads:[~2023-10-25 15:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 15:33 [PATCH 0/3] cindex: prune fixes Eric Wong
2023-10-25 15:33 ` [PATCH 1/3] cindex: store coderepo data asynchronously Eric Wong
2023-10-25 15:33 ` Eric Wong [this message]
2023-10-25 15:33 ` [PATCH 3/3] cindex: fix large prunes Eric Wong
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
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231025153349.3247178-3-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.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).