summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Derrick Stolee <dstolee@microsoft.com>2020-11-25 22:12:55 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-11-25 14:43:48 -0800
commit3f1bae1dc3432acf7c586cd938e524f8d30eed31 (patch)
tree3da05374bd1d240570a703424c3281122b86a97c /t
parentconfig: plumb --fixed-value into config API (diff)
downloadtgif-3f1bae1dc3432acf7c586cd938e524f8d30eed31.tar.xz
config: implement --fixed-value with --get*
The config builtin does its own regex matching of values for the --get, --get-all, and --get-regexp modes. Plumb the existing 'flags' parameter to the get_value() method so we can initialize the value-pattern argument as a fixed string instead of a regex pattern. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1300-config.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 4293ba22af..97a04c6cc2 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -2044,4 +2044,26 @@ test_expect_success '--fixed-value uses exact string matching' '
test_cmp expect actual
'
+test_expect_success '--get and --get-all with --fixed-value' '
+ test_when_finished rm -f config &&
+ META="a+b*c?d[e]f.g" &&
+ git config --file=config fixed.test bogus &&
+ git config --file=config --add fixed.test "$META" &&
+
+ git config --file=config --get fixed.test bogus &&
+ test_must_fail git config --file=config --get fixed.test "$META" &&
+ git config --file=config --get --fixed-value fixed.test "$META" &&
+ test_must_fail git config --file=config --get --fixed-value fixed.test non-existent &&
+
+ git config --file=config --get-all fixed.test bogus &&
+ test_must_fail git config --file=config --get-all fixed.test "$META" &&
+ git config --file=config --get-all --fixed-value fixed.test "$META" &&
+ test_must_fail git config --file=config --get-all --fixed-value fixed.test non-existent &&
+
+ git config --file=config --get-regexp fixed+ bogus &&
+ test_must_fail git config --file=config --get-regexp fixed+ "$META" &&
+ git config --file=config --get-regexp --fixed-value fixed+ "$META" &&
+ test_must_fail git config --file=config --get-regexp --fixed-value fixed+ non-existent
+'
+
test_done