From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 6CE631F9E5; Sun, 25 Jul 2021 10:40:17 +0000 (UTC) Date: Sun, 25 Jul 2021 10:40:17 +0000 From: Eric Wong To: meta@public-inbox.org Cc: Konstantin Ryabitsev Subject: [PATCH 3/2] init: support git <2.30 for "-c KEY=VALUE" args Message-ID: <20210725104017.GA2410@dcvr> References: <20210720211840.jl542wuyjh4ajowg@nitro.local> <20210721140550.9901-2-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210721140550.9901-2-e@80x24.org> List-Id: It turns out `--fixed-value' is a relatively new git-config(1) feature in git 2.30+ (December 2020). So use the quotemeta perlop for now since it seems compatible-enough for POSIX ERE used by git. --- script/public-inbox-init | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script/public-inbox-init b/script/public-inbox-init index e22a0564..6fac4d18 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -231,8 +231,11 @@ run_die([@x, "$pfx.newsgroup", $ng]) if $ng ne ''; for my $kv (@c_extra) { my ($k, $v) = split(/=/, $kv, 2); - # --fixed-value for idempotent invocations - run_die([@x, qw(--replace-all --fixed-value), "$pfx.$k", $v, $v]); + # git 2.30+ has --fixed-value for idempotent invocations, + # but that's too new to depend on in 2021. Perl quotemeta + # seems compatible enough for POSIX ERE which git uses + my $re = '^'.quotemeta($v).'$'; + run_die([@x, qw(--replace-all), "$pfx.$k", $v, $re]); } # needed for git prior to v2.1.0