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, T_SCC_BODY_TEXT_LINE 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 3A29E1F452 for ; Fri, 15 Dec 2023 00:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1702598891; bh=7BVvViZXiDweVVW78mnI/lvB2KCm0QOlYbv2Vka693Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PnBijrRg4jmpKur4dQxwlxeotZoVU8SWrPwzhZB5FGPO0ulZHsuctusXu2wchlhmz bcYAQqAsQWzPPXqERkUn0MI8Rh0h74Ogy4Wc878e+SHrQIjEQh5H57ckZ2M2ZDdw2A /jE0ZwQDMlTv59ouwnzuTCC8P9e7JY5RI4KNMukY= From: Eric Wong To: spew@80x24.org Subject: [PATCH 2/5] searchidx: quiet down old git patchid Date: Thu, 14 Dec 2023 19:08:07 -0500 Message-Id: <20231215000810.3458531-2-e@80x24.org> In-Reply-To: <20231215000810.3458531-1-e@80x24.org> References: <20231215000810.3458531-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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)"); + } } }