about summary refs log tree commit homepage
path: root/script/public-inbox-init
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-07-25 10:40:17 +0000
committerEric Wong <e@80x24.org>2021-07-25 10:40:45 +0000
commit36020c1e6284f22c8c4b10b4e418f66f74b28a97 (patch)
tree8aee951d137faee57f0df98057c5f676e624c4db /script/public-inbox-init
parentae74c666692f8056363c7adedd0edc4790439a8e (diff)
downloadpublic-inbox-36020c1e6284f22c8c4b10b4e418f66f74b28a97.tar.gz
init: support git <2.30 for "-c KEY=VALUE" args
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.
Diffstat (limited to 'script/public-inbox-init')
-rwxr-xr-xscript/public-inbox-init7
1 files 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