* [PATCH 2/5] searchidx: quiet down old git patchid
2023-12-15 20:22 6% [PATCH 0/5] old git and Test::More fixes Eric Wong
@ 2023-12-15 20:22 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-12-15 20:22 UTC (permalink / raw)
To: meta
CentOS 7.x ships with git 1.8.5, so unless a CentOS 7.x user
enables 3rd-party repos[1], they'll be stuck with a version
of git without `--stable' (though I'm becoming skeptical of
indexing patchids at all).
[1] https://public-inbox.org/meta/20210421151308.yz5hzkgm75klunpe@nitro.local/
---
lib/PublicInbox/SearchIdx.pm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 1ac8e33e..1cbf6d23 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -44,6 +44,7 @@ my $hex = '[a-f0-9]';
my $OID = $hex .'{40,}';
my @VMD_MAP = (kw => 'K', L => 'L'); # value order matters
our $INDEXLEVELS = qr/\A(?:full|medium|basic)\z/;
+our $PATCHID_BROKEN;
sub new {
my ($class, $ibx, $creat, $shard) = @_;
@@ -63,6 +64,7 @@ sub new {
die("Invalid indexlevel $ibx->{indexlevel}\n");
}
}
+ undef $PATCHID_BROKEN; # retry on new instances in case of upgrades
$ibx = PublicInbox::InboxWritable->new($ibx);
my $self = PublicInbox::Search->new($ibx);
bless $self, $class;
@@ -353,7 +355,8 @@ sub index_diff ($$$) {
sub index_body_text {
my ($self, $doc, $sref) = @_;
my $rd;
- if ($$sref =~ /^(?:diff|---|\+\+\+) /ms) { # start patch-id in parallel
+ # start patch-id in parallel
+ if ($$sref =~ /^(?:diff|---|\+\+\+) /ms && !$PATCHID_BROKEN) {
my $git = ($self->{ibx} // $self->{eidx} // $self)->git;
my $fh = PublicInbox::IO::write_file '+>:utf8', undef, $$sref;
$fh->flush or die "flush: $!";
@@ -386,7 +389,12 @@ sub index_body_text {
if (defined $rd) { # reap `git patch-id'
(readline($rd) // '') =~ /\A([a-f0-9]{40,})/ and
$doc->add_term('XDFID'.$1);
- $rd->close or warn "W: git patch-id failed: \$?=$? (non-fatal)"
+ if (!$rd->close) {
+ my $c = 'git patch-id --stable';
+ $PATCHID_BROKEN = ($? >> 8) == 129;
+ $PATCHID_BROKEN ? warn("W: $c requires git v2.1.0+\n")
+ : warn("W: $c failed: \$?=$? (non-fatal)");
+ }
}
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/5] old git and Test::More fixes
@ 2023-12-15 20:22 6% Eric Wong
2023-12-15 20:22 7% ` [PATCH 2/5] searchidx: quiet down old git patchid Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-12-15 20:22 UTC (permalink / raw)
To: meta
This makes the experience nicer for people using CentOS 7.x
out-of-the-box (without 3rd-party repos).
Eric Wong (5):
tests: quiet uninitialized warnings on CentOS 7.x
searchidx: quiet down old git patchid
cindex: --prune needs git 2.6+
git: quiet down `rev-parse --git-path' errors
t/pop3d-limit: use v1 inbox to test on ancient git
lib/PublicInbox/CodeSearchIdx.pm | 2 ++
lib/PublicInbox/Git.pm | 4 +++-
lib/PublicInbox/SearchIdx.pm | 12 ++++++++++--
lib/PublicInbox/TestCommon.pm | 20 ++++++++++----------
t/cindex.t | 1 +
t/cmd_ipc.t | 4 ++--
t/ds-poll.t | 2 +-
t/httpd-corner.t | 2 +-
t/lei-convert.t | 2 +-
t/lei-daemon.t | 2 +-
t/lei-sigpipe.t | 2 +-
t/pop3d-limit.t | 2 +-
12 files changed, 34 insertions(+), 21 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-12-15 20:22 6% [PATCH 0/5] old git and Test::More fixes Eric Wong
2023-12-15 20:22 7% ` [PATCH 2/5] searchidx: quiet down old git patchid 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).