Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2020-11-26 01:12:55 +0300
committerJunio C Hamano <gitster@pobox.com>2020-11-26 01:43:48 +0300
commit3f1bae1dc3432acf7c586cd938e524f8d30eed31 (patch)
tree3da05374bd1d240570a703424c3281122b86a97c /t/t1300-config.sh
parentc90702a1f6f7473a959994a2dff0f0dd450b8029 (diff)
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/t1300-config.sh')
-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