[PATCH 7/8] t1300: exercise both old- and new-style modes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Convert t1300 so that tests exercise both the old and new-style way to
specify the mode.

Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
---
 t/t1300-config.sh | 721 ++++++++++++++++++++++++----------------------
 1 file changed, 375 insertions(+), 346 deletions(-)

diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 2d1bc1e27e..705c17a1fb 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -11,6 +11,24 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
+for style in old new
+do
+
+case "$style" in
+old)
+	mode_prefix="--"
+	mode_get=""
+	mode_set=""
+	mode_set_all=""
+	;;
+new)
+	mode_prefix=""
+	mode_get="get"
+	mode_set="set"
+	mode_set_all="set-all"
+	;;
+esac
+
 test_expect_success 'clear default config' '
 	rm -f .git/config
 '
@@ -20,7 +38,7 @@ cat > expect << EOF
 	penguin = little blue
 EOF
 test_expect_success 'initial' '
-	git config section.penguin "little blue" &&
+	git config ${mode_set} section.penguin "little blue" &&
 	test_cmp expect .git/config
 '
 
@@ -30,7 +48,7 @@ cat > expect << EOF
 	Movie = BadPhysics
 EOF
 test_expect_success 'mixed case' '
-	git config Section.Movie BadPhysics &&
+	git config ${mode_set} Section.Movie BadPhysics &&
 	test_cmp expect .git/config
 '
 
@@ -42,7 +60,7 @@ cat > expect << EOF
 	WhatEver = Second
 EOF
 test_expect_success 'similar section' '
-	git config Sections.WhatEver Second &&
+	git config ${mode_set} Sections.WhatEver Second &&
 	test_cmp expect .git/config
 '
 
@@ -55,16 +73,16 @@ cat > expect << EOF
 	WhatEver = Second
 EOF
 test_expect_success 'uppercase section' '
-	git config SECTION.UPPERCASE true &&
+	git config ${mode_set} SECTION.UPPERCASE true &&
 	test_cmp expect .git/config
 '
 
 test_expect_success 'replace with non-match' '
-	git config section.penguin kingpin !blue
+	git config ${mode_set_all} section.penguin kingpin !blue
 '
 
 test_expect_success 'replace with non-match (actually matching)' '
-	git config section.penguin "very blue" !kingpin
+	git config ${mode_set_all} section.penguin "very blue" !kingpin
 '
 
 cat > expect << EOF
@@ -102,7 +120,7 @@ test_missing_key () {
 	local key="$1" &&
 	local title="$2" &&
 	test_expect_success "value for $title is not printed" '
-		test_must_fail git config "$key" >out 2>err &&
+		test_must_fail git config ${mode_get} "$key" >out 2>err &&
 		test_must_be_empty out &&
 		test_must_be_empty err
 	'
@@ -125,7 +143,7 @@ foo = bar
 EOF
 
 test_expect_success 'unset with cont. lines' '
-	git config --unset beta.baz
+	git config ${mode_prefix}unset beta.baz
 '
 
 cat > expect <<\EOF
@@ -152,7 +170,7 @@ EOF
 cp .git/config .git/config2
 
 test_expect_success 'multiple unset' '
-	git config --unset-all beta.haha
+	git config ${mode_prefix}unset-all beta.haha
 '
 
 cat > expect << EOF
@@ -178,7 +196,7 @@ test_expect_success '--replace-all missing value' '
 rm .git/config2
 
 test_expect_success '--replace-all' '
-	git config --replace-all beta.haha gamma
+	git config ${mode_prefix}replace-all beta.haha gamma
 '
 
 cat > expect << EOF
@@ -220,7 +238,7 @@ noIndent= sillyValue ; 'nother silly comment
 	nonewline = wow
 EOF
 test_expect_success 'really really mean test' '
-	git config nextsection.nonewline wow &&
+	git config ${mode_set} nextsection.nonewline wow &&
 	test_cmp expect .git/config
 '
 
@@ -238,7 +256,7 @@ noIndent= sillyValue ; 'nother silly comment
 	nonewline = wow
 EOF
 test_expect_success 'unset' '
-	git config --unset beta.haha &&
+	git config ${mode_prefix}unset beta.haha &&
 	test_cmp expect .git/config
 '
 
@@ -258,15 +276,15 @@ test_expect_success 'multivar' '
 '
 
 test_expect_success 'non-match' '
-	git config --get nextsection.nonewline !for
+	git config ${mode_prefix}get nextsection.nonewline !for
 '
 
 test_expect_success 'non-match value' '
-	test_cmp_config wow --get nextsection.nonewline !for
+	test_cmp_config wow ${mode_prefix}get nextsection.nonewline !for
 '
 
 test_expect_success 'multi-valued get returns final one' '
-	test_cmp_config "wow2 for me" --get nextsection.nonewline
+	test_cmp_config "wow2 for me" ${mode_prefix}get nextsection.nonewline
 '
 
 test_expect_success 'multi-valued get-all returns all' '
@@ -274,7 +292,7 @@ test_expect_success 'multi-valued get-all returns all' '
 	wow
 	wow2 for me
 	EOF
-	git config --get-all nextsection.nonewline >actual &&
+	git config ${mode_prefix}get-all nextsection.nonewline >actual &&
 	test_cmp expect actual
 '
 
@@ -289,16 +307,16 @@ noIndent= sillyValue ; 'nother silly comment
 	NoNewLine = wow2 for me
 EOF
 test_expect_success 'multivar replace' '
-	git config nextsection.nonewline "wow3" "wow$" &&
+	git config ${mode_set_all} nextsection.nonewline "wow3" "wow$" &&
 	test_cmp expect .git/config
 '
 
 test_expect_success 'ambiguous unset' '
-	test_must_fail git config --unset nextsection.nonewline
+	test_must_fail git config ${mode_prefix}unset nextsection.nonewline
 '
 
 test_expect_success 'invalid unset' '
-	test_must_fail git config --unset somesection.nonewline
+	test_must_fail git config ${mode_prefix}unset somesection.nonewline
 '
 
 cat > expect << EOF
@@ -312,16 +330,16 @@ noIndent= sillyValue ; 'nother silly comment
 EOF
 
 test_expect_success 'multivar unset' '
-	git config --unset nextsection.nonewline "wow3$" &&
+	git config ${mode_prefix}unset nextsection.nonewline "wow3$" &&
 	test_cmp expect .git/config
 '
 
-test_expect_success 'invalid key' 'test_must_fail git config inval.2key blabla'
+test_expect_success 'invalid key' 'test_must_fail git config ${mode_set} inval.2key blabla'
 
-test_expect_success 'correct key' 'git config 123456.a123 987'
+test_expect_success 'correct key' 'git config ${mode_set} 123456.a123 987'
 
 test_expect_success 'hierarchical section' '
-	git config Version.1.2.3eX.Alpha beta
+	git config ${mode_set} Version.1.2.3eX.Alpha beta
 '
 
 cat > expect << EOF
@@ -350,11 +368,11 @@ version.1.2.3eX.alpha=beta
 EOF
 
 test_expect_success 'working --list' '
-	git config --list > output &&
+	git config ${mode_prefix}list > output &&
 	test_cmp expect output
 '
 test_expect_success '--list without repo produces empty output' '
-	git --git-dir=nonexistent config --list >output &&
+	git --git-dir=nonexistent config ${mode_prefix}list >output &&
 	test_must_be_empty output
 '
 
@@ -366,7 +384,7 @@ version.1.2.3eX.alpha
 EOF
 
 test_expect_success '--name-only --list' '
-	git config --name-only --list >output &&
+	git config ${mode_prefix}list --name-only >output &&
 	test_cmp expect output
 '
 
@@ -376,7 +394,7 @@ nextsection.nonewline wow2 for me
 EOF
 
 test_expect_success '--get-regexp' '
-	git config --get-regexp in >output &&
+	git config ${mode_prefix}get-regexp in >output &&
 	test_cmp expect output
 '
 
@@ -386,7 +404,7 @@ nextsection.nonewline
 EOF
 
 test_expect_success '--name-only --get-regexp' '
-	git config --name-only --get-regexp in >output &&
+	git config ${mode_prefix}get-regexp --name-only in >output &&
 	test_cmp expect output
 '
 
@@ -396,8 +414,8 @@ wow4 for you
 EOF
 
 test_expect_success '--add' '
-	git config --add nextsection.nonewline "wow4 for you" &&
-	git config --get-all nextsection.nonewline > output &&
+	git config ${mode_prefix}add nextsection.nonewline "wow4 for you" &&
+	git config ${mode_prefix}get-all nextsection.nonewline > output &&
 	test_cmp expect output
 '
 
@@ -409,45 +427,45 @@ cat > .git/config << EOF
 EOF
 
 test_expect_success 'get variable with no value' '
-	git config --get novalue.variable ^$
+	git config ${mode_prefix}get novalue.variable ^$
 '
 
 test_expect_success 'get variable with empty value' '
-	git config --get emptyvalue.variable ^$
+	git config ${mode_prefix}get emptyvalue.variable ^$
 '
 
 echo novalue.variable > expect
 
 test_expect_success 'get-regexp variable with no value' '
-	git config --get-regexp novalue > output &&
+	git config ${mode_prefix}get-regexp novalue > output &&
 	test_cmp expect output
 '
 
 echo 'novalue.variable true' > expect
 
 test_expect_success 'get-regexp --bool variable with no value' '
-	git config --bool --get-regexp novalue > output &&
+	git config ${mode_prefix}get-regexp --bool novalue > output &&
 	test_cmp expect output
 '
 
 echo 'emptyvalue.variable ' > expect
 
 test_expect_success 'get-regexp variable with empty value' '
-	git config --get-regexp emptyvalue > output &&
+	git config ${mode_prefix}get-regexp emptyvalue > output &&
 	test_cmp expect output
 '
 
 echo true > expect
 
 test_expect_success 'get bool variable with no value' '
-	git config --bool novalue.variable > output &&
+	git config ${mode_get} --bool novalue.variable > output &&
 	test_cmp expect output
 '
 
 echo false > expect
 
 test_expect_success 'get bool variable with empty value' '
-	git config --bool emptyvalue.variable > output &&
+	git config ${mode_get} --bool emptyvalue.variable > output &&
 	test_cmp expect output
 '
 
@@ -469,7 +487,7 @@ cat > expect << EOF
 EOF
 
 test_expect_success 'new section is partial match of another' '
-	git config a.x y &&
+	git config ${mode_set} a.x y &&
 	test_cmp expect .git/config
 '
 
@@ -484,14 +502,14 @@ cat > expect << EOF
 EOF
 
 test_expect_success 'new variable inserts into proper section' '
-	git config b.x y &&
-	git config a.b c &&
+	git config ${mode_set} b.x y &&
+	git config ${mode_set} a.b c &&
 	test_cmp expect .git/config
 '
 
 test_expect_success 'alternative --file (non-existing file should fail)' '
-	test_must_fail git config --file non-existing-config -l &&
-	test_must_fail git config --file non-existing-config test.xyzzy
+	test_must_fail git config ${mode_prefix}list --file non-existing-config &&
+	test_must_fail git config ${mode_get} --file non-existing-config test.xyzzy
 '
 
 cat > other-config << EOF
@@ -504,29 +522,30 @@ ein.bahn=strasse
 EOF
 
 test_expect_success 'alternative GIT_CONFIG' '
-	GIT_CONFIG=other-config git config --list >output &&
+	GIT_CONFIG=other-config git config ${mode_prefix}list >output &&
 	test_cmp expect output
 '
 
 test_expect_success 'alternative GIT_CONFIG (--file)' '
-	git config --file other-config --list >output &&
+	git config ${mode_prefix}list --file other-config >output &&
 	test_cmp expect output
 '
 
 test_expect_success 'alternative GIT_CONFIG (--file=-)' '
-	git config --file - --list <other-config >output &&
+	git config ${mode_prefix}list --file - <other-config >output &&
 	test_cmp expect output
 '
 
 test_expect_success 'setting a value in stdin is an error' '
-	test_must_fail git config --file - some.value foo
+	test_must_fail git config ${mode_set} --file - some.value foo
 '
 
 test_expect_success 'editing stdin is an error' '
-	test_must_fail git config --file - --edit
+	test_must_fail git config ${mode_prefix}edit --file -
 '
 
 test_expect_success 'refer config from subdirectory' '
+	test_when_finished "rm -r x" &&
 	mkdir x &&
 	test_cmp_config -C x strasse --file=../other-config --get ein.bahn
 '
@@ -539,7 +558,7 @@ cat > expect << EOF
 EOF
 
 test_expect_success '--set in alternative file' '
-	git config --file=other-config anwohner.park ausweis &&
+	git config ${mode_set} --file=other-config anwohner.park ausweis &&
 	test_cmp expect other-config
 '
 
@@ -555,7 +574,7 @@ weird
 EOF
 
 test_expect_success 'rename section' '
-	git config --rename-section branch.eins branch.zwei
+	git config ${mode_prefix}rename-section branch.eins branch.zwei
 '
 
 cat > expect << EOF
@@ -574,7 +593,7 @@ test_expect_success 'rename succeeded' '
 '
 
 test_expect_success 'rename non-existing section' '
-	test_must_fail git config --rename-section \
+	test_must_fail git config ${mode_prefix}rename-section \
 		branch."world domination" branch.drei
 '
 
@@ -583,7 +602,7 @@ test_expect_success 'rename succeeded' '
 '
 
 test_expect_success 'rename another section' '
-	git config --rename-section branch."1 234 blabl/a" branch.drei
+	git config ${mode_prefix}rename-section branch."1 234 blabl/a" branch.drei
 '
 
 cat > expect << EOF
@@ -606,7 +625,7 @@ cat >> .git/config << EOF
 EOF
 
 test_expect_success 'rename a section with a var on the same line' '
-	git config --rename-section branch.vier branch.zwei
+	git config ${mode_prefix}rename-section branch.vier branch.zwei
 '
 
 cat > expect << EOF
@@ -627,11 +646,11 @@ test_expect_success 'rename succeeded' '
 '
 
 test_expect_success 'renaming empty section name is rejected' '
-	test_must_fail git config --rename-section branch.zwei ""
+	test_must_fail git config ${mode_prefix}rename-section branch.zwei ""
 '
 
 test_expect_success 'renaming to bogus section is rejected' '
-	test_must_fail git config --rename-section branch.zwei "bogus name"
+	test_must_fail git config ${mode_prefix}rename-section branch.zwei "bogus name"
 '
 
 test_expect_success 'renaming a section with a long line' '
@@ -640,7 +659,7 @@ test_expect_success 'renaming a section with a long line' '
 		printf "  c = d %1024s [a] e = f\\n" " " &&
 		printf "[a] g = h\\n"
 	} >y &&
-	git config -f y --rename-section a xyz &&
+	git config ${mode_prefix}rename-section -f y a xyz &&
 	test_must_fail git config -f y b.e
 '
 
@@ -650,7 +669,7 @@ test_expect_success 'renaming an embedded section with a long line' '
 		printf "  c = d %1024s [a] [foo] e = f\\n" " " &&
 		printf "[a] g = h\\n"
 	} >y &&
-	git config -f y --rename-section a xyz &&
+	git config ${mode_prefix}rename-section -f y a xyz &&
 	test_must_fail git config -f y foo.e
 '
 
@@ -660,7 +679,7 @@ test_expect_success 'renaming a section with an overly-long line' '
 		printf "  c = d %525000s e" " " &&
 		printf "[a] g = h\\n"
 	} >y &&
-	test_must_fail git config -f y --rename-section a xyz 2>err &&
+	test_must_fail git config ${mode_prefix}rename-section -f y a xyz 2>err &&
 	grep "refusing to work with overly long line in .y. on line 2" err
 '
 
@@ -669,7 +688,7 @@ cat >> .git/config << EOF
 EOF
 
 test_expect_success 'remove section' '
-	git config --remove-section branch.zwei
+	git config ${mode_prefix}remove-section branch.zwei
 '
 
 cat > expect << EOF
@@ -693,20 +712,20 @@ EOF
 
 test_expect_success 'section ending' '
 	rm -f .git/config &&
-	git config gitcvs.enabled true &&
-	git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
-	git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
+	git config ${mode_set} gitcvs.enabled true &&
+	git config ${mode_set} gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
+	git config ${mode_set} gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
 	test_cmp expect .git/config
 
 '
 
 test_expect_success numbers '
-	git config kilo.gram 1k &&
-	git config mega.ton 1m &&
+	git config ${mode_set} kilo.gram 1k &&
+	git config ${mode_set} mega.ton 1m &&
 	echo 1024 >expect &&
 	echo 1048576 >>expect &&
-	git config --int --get kilo.gram >actual &&
-	git config --int --get mega.ton >>actual &&
+	git config ${mode_prefix}get --int kilo.gram >actual &&
+	git config ${mode_prefix}get --int mega.ton >>actual &&
 	test_cmp expect actual
 '
 
@@ -719,25 +738,25 @@ test_expect_success '--int is at least 64 bits' '
 test_expect_success 'invalid unit' '
 	git config aninvalid.unit "1auto" &&
 	test_cmp_config 1auto aninvalid.unit &&
-	test_must_fail git config --int --get aninvalid.unit 2>actual &&
+	test_must_fail git config ${mode_prefix}get --int aninvalid.unit 2>actual &&
 	test_grep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
 '
 
 test_expect_success 'invalid unit boolean' '
 	git config commit.gpgsign "1true" &&
 	test_cmp_config 1true commit.gpgsign &&
-	test_must_fail git config --bool --get commit.gpgsign 2>actual &&
+	test_must_fail git config ${mode_prefix}get --bool commit.gpgsign 2>actual &&
 	test_grep "bad boolean config value .1true. for .commit.gpgsign." actual
 '
 
 test_expect_success 'line number is reported correctly' '
 	printf "[bool]\n\tvar\n" >invalid &&
-	test_must_fail git config -f invalid --path bool.var 2>actual &&
+	test_must_fail git config ${mode_get} -f invalid --path bool.var 2>actual &&
 	test_grep "line 2" actual
 '
 
 test_expect_success 'invalid stdin config' '
-	echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
+	echo "[broken" | test_must_fail git config ${mode_prefix}list --file - >output 2>&1 &&
 	test_grep "bad config line 1 in standard input" output
 '
 
@@ -765,19 +784,19 @@ test_expect_success bool '
 	rm -f result &&
 	for i in 1 2 3 4
 	do
-	    git config --bool --get bool.true$i >>result &&
-	    git config --bool --get bool.false$i >>result || return 1
+	    git config ${mode_prefix}get --bool bool.true$i >>result &&
+	    git config ${mode_prefix}get --bool bool.false$i >>result || return 1
 	done &&
 	test_cmp expect result'
 
 test_expect_success 'invalid bool (--get)' '
 
 	git config bool.nobool foobar &&
-	test_must_fail git config --bool --get bool.nobool'
+	test_must_fail git config ${mode_prefix}get --bool bool.nobool'
 
 test_expect_success 'invalid bool (set)' '
 
-	test_must_fail git config --bool bool.nobool foobar'
+	test_must_fail git config ${mode_set} --bool bool.nobool foobar'
 
 cat > expect <<\EOF
 [bool]
@@ -794,14 +813,14 @@ EOF
 test_expect_success 'set --bool' '
 
 	rm -f .git/config &&
-	git config --bool bool.true1 01 &&
-	git config --bool bool.true2 -1 &&
-	git config --bool bool.true3 YeS &&
-	git config --bool bool.true4 true &&
-	git config --bool bool.false1 000 &&
-	git config --bool bool.false2 "" &&
-	git config --bool bool.false3 nO &&
-	git config --bool bool.false4 FALSE &&
+	git config ${mode_set} --bool bool.true1 01 &&
+	git config ${mode_set} --bool bool.true2 -1 &&
+	git config ${mode_set} --bool bool.true3 YeS &&
+	git config ${mode_set} --bool bool.true4 true &&
+	git config ${mode_set} --bool bool.false1 000 &&
+	git config ${mode_set} --bool bool.false2 "" &&
+	git config ${mode_set} --bool bool.false3 nO &&
+	git config ${mode_set} --bool bool.false4 FALSE &&
 	test_cmp expect .git/config'
 
 cat > expect <<\EOF
@@ -814,9 +833,9 @@ EOF
 test_expect_success 'set --int' '
 
 	rm -f .git/config &&
-	git config --int int.val1 01 &&
-	git config --int int.val2 -1 &&
-	git config --int int.val3 5m &&
+	git config ${mode_set} --int int.val1 01 &&
+	git config ${mode_set} --int int.val2 -1 &&
+	git config ${mode_set} --int int.val3 5m &&
 	test_cmp expect .git/config
 '
 
@@ -840,12 +859,12 @@ test_expect_success 'get --bool-or-int' '
 	-1
 	EOF
 	{
-		git config --bool-or-int bool.true1 &&
-		git config --bool-or-int bool.true2 &&
-		git config --bool-or-int bool.false &&
-		git config --bool-or-int int.int1 &&
-		git config --bool-or-int int.int2 &&
-		git config --bool-or-int int.int3
+		git config ${mode_get} --bool-or-int bool.true1 &&
+		git config ${mode_get} --bool-or-int bool.true2 &&
+		git config ${mode_get} --bool-or-int bool.false &&
+		git config ${mode_get} --bool-or-int int.int1 &&
+		git config ${mode_get} --bool-or-int int.int2 &&
+		git config ${mode_get} --bool-or-int int.int3
 	} >actual &&
 	test_cmp expect actual
 '
@@ -864,13 +883,13 @@ EOF
 
 test_expect_success 'set --bool-or-int' '
 	rm -f .git/config &&
-	git config --bool-or-int bool.true1 true &&
-	git config --bool-or-int bool.false1 false &&
-	git config --bool-or-int bool.true2 yes &&
-	git config --bool-or-int bool.false2 no &&
-	git config --bool-or-int int.int1 0 &&
-	git config --bool-or-int int.int2 1 &&
-	git config --bool-or-int int.int3 -1 &&
+	git config ${mode_set} --bool-or-int bool.true1 true &&
+	git config ${mode_set} --bool-or-int bool.false1 false &&
+	git config ${mode_set} --bool-or-int bool.true2 yes &&
+	git config ${mode_set} --bool-or-int bool.false2 no &&
+	git config ${mode_set} --bool-or-int int.int1 0 &&
+	git config ${mode_set} --bool-or-int int.int2 1 &&
+	git config ${mode_set} --bool-or-int int.int3 -1 &&
 	test_cmp expect .git/config
 '
 
@@ -883,9 +902,9 @@ EOF
 
 test_expect_success !MINGW 'set --path' '
 	rm -f .git/config &&
-	git config --path path.home "~/" &&
-	git config --path path.normal "/dev/null" &&
-	git config --path path.trailingtilde "foo~" &&
+	git config ${mode_set} --path path.home "~/" &&
+	git config ${mode_set} --path path.normal "/dev/null" &&
+	git config ${mode_set} --path path.trailingtilde "foo~" &&
 	test_cmp expect .git/config'
 
 if test_have_prereq !MINGW && test "${HOME+set}"
@@ -900,9 +919,9 @@ foo~
 EOF
 
 test_expect_success HOMEVAR 'get --path' '
-	git config --get --path path.home > result &&
-	git config --get --path path.normal >> result &&
-	git config --get --path path.trailingtilde >> result &&
+	git config ${mode_prefix}get --path path.home > result &&
+	git config ${mode_prefix}get --path path.normal >> result &&
+	git config ${mode_prefix}get --path path.trailingtilde >> result &&
 	test_cmp expect result
 '
 
@@ -914,10 +933,10 @@ EOF
 test_expect_success !MINGW 'get --path copes with unset $HOME' '
 	(
 		sane_unset HOME &&
-		test_must_fail git config --get --path path.home \
+		test_must_fail git config ${mode_prefix}get --path path.home \
 			>result 2>msg &&
-		git config --get --path path.normal >>result &&
-		git config --get --path path.trailingtilde >>result
+		git config ${mode_prefix}get --path path.normal >>result &&
+		git config ${mode_prefix}get --path path.trailingtilde >>result
 	) &&
 	test_grep "[Ff]ailed to expand.*~/" msg &&
 	test_cmp expect result
@@ -925,7 +944,7 @@ test_expect_success !MINGW 'get --path copes with unset $HOME' '
 
 test_expect_success 'get --path barfs on boolean variable' '
 	echo "[path]bool" >.git/config &&
-	test_must_fail git config --get --path path.bool
+	test_must_fail git config ${mode_prefix}get --path path.bool
 '
 
 test_expect_success 'get --expiry-date' '
@@ -949,20 +968,20 @@ test_expect_success 'get --expiry-date' '
 	EOF
 	: "work around heredoc parsing bug fixed in dash 0.5.7 (in ec2c84d)" &&
 	{
-		echo "$rel_out $(git config --expiry-date date.valid1)" &&
-		git config --expiry-date date.valid2 &&
-		git config --expiry-date date.valid3 &&
-		git config --expiry-date date.valid4 &&
-		git config --expiry-date date.valid5
+		echo "$rel_out $(git config ${mode_get} --expiry-date date.valid1)" &&
+		git config ${mode_get} --expiry-date date.valid2 &&
+		git config ${mode_get} --expiry-date date.valid3 &&
+		git config ${mode_get} --expiry-date date.valid4 &&
+		git config ${mode_get} --expiry-date date.valid5
 	} >actual &&
 	test_cmp expect actual &&
-	test_must_fail git config --expiry-date date.invalid1
+	test_must_fail git config ${mode_get} --expiry-date date.invalid1
 '
 
 test_expect_success 'get --type=color' '
 	rm .git/config &&
 	git config foo.color "red" &&
-	git config --get --type=color foo.color >actual.raw &&
+	git config ${mode_prefix}get --type=color foo.color >actual.raw &&
 	test_decode_color <actual.raw >actual &&
 	echo "<RED>" >expect &&
 	test_cmp expect actual
@@ -975,17 +994,17 @@ EOF
 
 test_expect_success 'set --type=color' '
 	rm .git/config &&
-	git config --type=color foo.color "red" &&
+	git config ${mode_set} --type=color foo.color "red" &&
 	test_cmp expect .git/config
 '
 
 test_expect_success 'get --type=color barfs on non-color' '
 	echo "[foo]bar=not-a-color" >.git/config &&
-	test_must_fail git config --get --type=color foo.bar
+	test_must_fail git config ${mode_prefix}get --type=color foo.bar
 '
 
 test_expect_success 'set --type=color barfs on non-color' '
-	test_must_fail git config --type=color foo.color "not-a-color" 2>error &&
+	test_must_fail git config ${mode_set} --type=color foo.color "not-a-color" 2>error &&
 	test_grep "cannot parse color" error
 '
 
@@ -998,18 +1017,18 @@ cat > expect << EOF
 EOF
 test_expect_success 'quoting' '
 	rm -f .git/config &&
-	git config quote.leading " test" &&
-	git config quote.ending "test " &&
-	git config quote.semicolon "test;test" &&
-	git config quote.hash "test#test" &&
+	git config ${mode_set} quote.leading " test" &&
+	git config ${mode_set} quote.ending "test " &&
+	git config ${mode_set} quote.semicolon "test;test" &&
+	git config ${mode_set} quote.hash "test#test" &&
 	test_cmp expect .git/config
 '
 
 test_expect_success 'key with newline' '
-	test_must_fail git config "key.with
+	test_must_fail git config ${mode_set} "key.with
 newline" 123'
 
-test_expect_success 'value with newline' 'git config key.sub value.with\\\
+test_expect_success 'value with newline' 'git config ${mode_set} key.sub value.with\\\
 newline'
 
 cat > .git/config <<\EOF
@@ -1029,7 +1048,7 @@ section.quotecont=cont;inued
 EOF
 
 test_expect_success 'value continued on next line' '
-	git config --list > result &&
+	git config ${mode_prefix}list > result &&
 	test_cmp expect result
 '
 
@@ -1053,14 +1072,14 @@ Qsection.sub=section.val4
 Qsection.sub=section.val5Q
 EOF
 test_expect_success '--null --list' '
-	git config --null --list >result.raw &&
+	git config ${mode_prefix}list --null >result.raw &&
 	nul_to_q <result.raw >result &&
 	echo >>result &&
 	test_cmp expect result
 '
 
 test_expect_success '--null --get-regexp' '
-	git config --null --get-regexp "val[0-9]" >result.raw &&
+	git config ${mode_prefix}get-regexp --null "val[0-9]" >result.raw &&
 	nul_to_q <result.raw >result &&
 	echo >>result &&
 	test_cmp expect result
@@ -1072,12 +1091,13 @@ test_expect_success 'inner whitespace kept verbatim' '
 '
 
 test_expect_success SYMLINKS 'symlinked configuration' '
+	test_when_finished "rm myconfig" &&
 	ln -s notyet myconfig &&
-	git config --file=myconfig test.frotz nitfol &&
+	git config ${mode_set} --file=myconfig test.frotz nitfol &&
 	test -h myconfig &&
 	test -f notyet &&
-	test "z$(git config --file=notyet test.frotz)" = znitfol &&
-	git config --file=myconfig test.xyzzy rezrov &&
+	test "z$(git config ${mode_get} --file=notyet test.frotz)" = znitfol &&
+	git config ${mode_set} --file=myconfig test.xyzzy rezrov &&
 	test -h myconfig &&
 	test -f notyet &&
 	cat >expect <<-\EOF &&
@@ -1085,17 +1105,18 @@ test_expect_success SYMLINKS 'symlinked configuration' '
 	rezrov
 	EOF
 	{
-		git config --file=notyet test.frotz &&
-		git config --file=notyet test.xyzzy
+		git config ${mode_get} --file=notyet test.frotz &&
+		git config ${mode_get} --file=notyet test.xyzzy
 	} >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success SYMLINKS 'symlink to nonexistent configuration' '
+	test_when_finished "rm linktonada linktolinktonada" &&
 	ln -s doesnotexist linktonada &&
 	ln -s linktonada linktolinktonada &&
-	test_must_fail git config --file=linktonada --list &&
-	test_must_fail git config --file=linktolinktonada --list
+	test_must_fail git config ${mode_prefix}list --file=linktonada &&
+	test_must_fail git config ${mode_prefix}list --file=linktolinktonada
 '
 
 test_expect_success 'check split_cmdline return' '
@@ -1103,12 +1124,12 @@ test_expect_success 'check split_cmdline return' '
 	git init repo &&
 	(
 		cd repo &&
-		git config alias.split-cmdline-fix "echo \"" &&
+		git config ${mode_set} alias.split-cmdline-fix "echo \"" &&
 		test_must_fail git split-cmdline-fix &&
 		echo foo >foo &&
 		git add foo &&
 		git commit -m "initial commit" &&
-		git config branch.main.mergeoptions "echo \"" &&
+		git config ${mode_set} branch.main.mergeoptions "echo \"" &&
 		test_must_fail git merge main
 	)
 '
@@ -1122,10 +1143,10 @@ test_expect_success 'git -c "key=value" support' '
 	{
 		git -c section.name=value config section.name &&
 		git -c foo.CamelCase=value config foo.camelcase &&
-		git -c foo.flag config --bool foo.flag
+		git -c foo.flag config ${mode_get} --bool foo.flag
 	} >actual &&
 	test_cmp expect actual &&
-	test_must_fail git -c name=value config section.name
+	test_must_fail git -c name=value config ${mode_get} section.name
 '
 
 # We just need a type-specifier here that cares about the
@@ -1135,27 +1156,27 @@ test_expect_success 'git -c "key=value" support' '
 # its semantics.
 test_expect_success 'git -c can represent empty string' '
 	echo >expect &&
-	git -c foo.empty= config --path foo.empty >actual &&
+	git -c foo.empty= config ${mode_get} --path foo.empty >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'key sanity-checking' '
-	test_must_fail git config foo=bar &&
-	test_must_fail git config foo=.bar &&
-	test_must_fail git config foo.ba=r &&
-	test_must_fail git config foo.1bar &&
-	test_must_fail git config foo."ba
+	test_must_fail git config ${mode_get} foo=bar &&
+	test_must_fail git config ${mode_get} foo=.bar &&
+	test_must_fail git config ${mode_get} foo.ba=r &&
+	test_must_fail git config ${mode_get} foo.1bar &&
+	test_must_fail git config ${mode_get} foo."ba
 				z".bar &&
-	test_must_fail git config . false &&
-	test_must_fail git config .foo false &&
-	test_must_fail git config foo. false &&
-	test_must_fail git config .foo. false &&
-	git config foo.bar true &&
-	git config foo."ba =z".bar false
+	test_must_fail git config ${mode_set} . false &&
+	test_must_fail git config ${mode_set} .foo false &&
+	test_must_fail git config ${mode_set} foo. false &&
+	test_must_fail git config ${mode_set} .foo. false &&
+	git config ${mode_set} foo.bar true &&
+	git config ${mode_set} foo."ba =z".bar false
 '
 
 test_expect_success 'git -c works with aliases of builtins' '
-	git config alias.checkconfig "-c foo.check=bar config foo.check" &&
+	git config ${mode_set} alias.checkconfig "-c foo.check=bar config foo.check" &&
 	echo bar >expect &&
 	git checkconfig >actual &&
 	test_cmp expect actual
@@ -1167,7 +1188,7 @@ test_expect_success 'aliases can be CamelCased' '
 	(
 		cd repo &&
 		test_commit A &&
-		git config alias.CamelCased "rev-parse HEAD" &&
+		git config ${mode_set} alias.CamelCased "rev-parse HEAD" &&
 		git CamelCased >out &&
 		git rev-parse HEAD >expect &&
 		test_cmp expect out
@@ -1176,7 +1197,7 @@ test_expect_success 'aliases can be CamelCased' '
 
 test_expect_success 'git -c does not split values on equals' '
 	echo "value with = in it" >expect &&
-	git -c section.foo="value with = in it" config section.foo >actual &&
+	git -c section.foo="value with = in it" config ${mode_get} section.foo >actual &&
 	test_cmp expect actual
 '
 
@@ -1193,7 +1214,7 @@ test_expect_success 'git -c complains about empty key and value' '
 '
 
 test_expect_success 'multiple git -c appends config' '
-	test_config alias.x "!git -c x.two=2 config --get-regexp ^x\.*" &&
+	test_config alias.x "!git -c x.two=2 config ${mode_prefix}get-regexp ^x\.*" &&
 	cat >expect <<-\EOF &&
 	x.one 1
 	x.two 2
@@ -1210,14 +1231,14 @@ test_expect_success 'last one wins: two level vars' '
 
 	echo VAL >expect &&
 
-	git -c sec.var=val -c sec.VAR=VAL config --get sec.var >actual &&
+	git -c sec.var=val -c sec.VAR=VAL config ${mode_prefix}get sec.var >actual &&
 	test_cmp expect actual &&
-	git -c SEC.var=val -c sec.var=VAL config --get sec.var >actual &&
+	git -c SEC.var=val -c sec.var=VAL config ${mode_prefix}get sec.var >actual &&
 	test_cmp expect actual &&
 
-	git -c sec.var=val -c sec.VAR=VAL config --get SEC.var >actual &&
+	git -c sec.var=val -c sec.VAR=VAL config ${mode_prefix}get SEC.var >actual &&
 	test_cmp expect actual &&
-	git -c SEC.var=val -c sec.var=VAL config --get sec.VAR >actual &&
+	git -c SEC.var=val -c sec.var=VAL config ${mode_prefix}get sec.VAR >actual &&
 	test_cmp expect actual
 '
 
@@ -1228,9 +1249,9 @@ test_expect_success 'last one wins: three level vars' '
 	# case sensitive.
 
 	echo val >expect &&
-	git -c v.a.r=val -c v.A.r=VAL config --get v.a.r >actual &&
+	git -c v.a.r=val -c v.A.r=VAL config ${mode_prefix}get v.a.r >actual &&
 	test_cmp expect actual &&
-	git -c v.a.r=val -c v.A.r=VAL config --get V.a.R >actual &&
+	git -c v.a.r=val -c v.A.r=VAL config ${mode_prefix}get V.a.R >actual &&
 	test_cmp expect actual &&
 
 	# v.a.r and V.a.R are the same variable, as the first
@@ -1238,13 +1259,13 @@ test_expect_success 'last one wins: three level vars' '
 	# case insensitive.
 
 	echo VAL >expect &&
-	git -c v.a.r=val -c v.a.R=VAL config --get v.a.r >actual &&
+	git -c v.a.r=val -c v.a.R=VAL config ${mode_prefix}get v.a.r >actual &&
 	test_cmp expect actual &&
-	git -c v.a.r=val -c V.a.r=VAL config --get v.a.r >actual &&
+	git -c v.a.r=val -c V.a.r=VAL config ${mode_prefix}get v.a.r >actual &&
 	test_cmp expect actual &&
-	git -c v.a.r=val -c v.a.R=VAL config --get V.a.R >actual &&
+	git -c v.a.r=val -c v.a.R=VAL config ${mode_prefix}get V.a.R >actual &&
 	test_cmp expect actual &&
-	git -c v.a.r=val -c V.a.r=VAL config --get V.a.R >actual &&
+	git -c v.a.r=val -c V.a.r=VAL config ${mode_prefix}get V.a.R >actual &&
 	test_cmp expect actual
 '
 
@@ -1259,7 +1280,7 @@ test_expect_success 'old-fashioned settings are case insensitive' '
 	[V.A]
 	Qr = value2
 	EOF
-	git config -f testConfig_actual "v.a.r" value2 &&
+	git config ${mode_set} -f testConfig_actual "v.a.r" value2 &&
 	test_cmp testConfig_expect testConfig_actual &&
 
 	cat >testConfig_actual <<-EOF &&
@@ -1270,7 +1291,7 @@ test_expect_success 'old-fashioned settings are case insensitive' '
 	[V.A]
 	QR = value2
 	EOF
-	git config -f testConfig_actual "V.a.R" value2 &&
+	git config ${mode_set} -f testConfig_actual "V.a.R" value2 &&
 	test_cmp testConfig_expect testConfig_actual &&
 
 	cat >testConfig_actual <<-EOF &&
@@ -1282,7 +1303,7 @@ test_expect_success 'old-fashioned settings are case insensitive' '
 	r = value1
 	Qr = value2
 	EOF
-	git config -f testConfig_actual "V.A.r" value2 &&
+	git config ${mode_set} -f testConfig_actual "V.A.r" value2 &&
 	test_cmp testConfig_expect testConfig_actual &&
 
 	cat >testConfig_actual <<-EOF &&
@@ -1294,7 +1315,7 @@ test_expect_success 'old-fashioned settings are case insensitive' '
 	r = value1
 	Qr = value2
 	EOF
-	git config -f testConfig_actual "v.A.r" value2 &&
+	git config ${mode_set} -f testConfig_actual "v.A.r" value2 &&
 	test_cmp testConfig_expect testConfig_actual
 '
 
@@ -1324,21 +1345,21 @@ test_expect_success 'setting different case sensitive subsections ' '
 	Qf = v2
 	EOF
 	# exact match
-	git config -f testConfig_actual a.b.c v2 &&
+	git config ${mode_set} -f testConfig_actual a.b.c v2 &&
 	# match section and subsection, key is cased differently.
-	git config -f testConfig_actual K.E.y v2 &&
+	git config ${mode_set} -f testConfig_actual K.E.y v2 &&
 	# section and key are matched case insensitive, but subsection needs
 	# to match; When writing out new values only the key is adjusted
-	git config -f testConfig_actual v.A.r v2 &&
+	git config ${mode_set} -f testConfig_actual v.A.r v2 &&
 	# subsection is not matched:
-	git config -f testConfig_actual d.E.f v2 &&
+	git config ${mode_set} -f testConfig_actual d.E.f v2 &&
 	test_cmp testConfig_expect testConfig_actual
 '
 
 for VAR in a .a a. a.0b a."b c". a."b c".0d
 do
 	test_expect_success "git -c $VAR=VAL rejects invalid '$VAR'" '
-		test_must_fail git -c "$VAR=VAL" config -l
+		test_must_fail git -c "$VAR=VAL" config ${mode_prefix}list
 	'
 done
 
@@ -1346,20 +1367,20 @@ for VAR in a.b a."b c".d
 do
 	test_expect_success "git -c $VAR=VAL works with valid '$VAR'" '
 		echo VAL >expect &&
-		git -c "$VAR=VAL" config --get "$VAR" >actual &&
+		git -c "$VAR=VAL" config ${mode_prefix}get "$VAR" >actual &&
 		test_cmp expect actual
 	'
 done
 
 test_expect_success 'git -c is not confused by empty environment' '
-	GIT_CONFIG_PARAMETERS="" git -c x.one=1 config --list
+	GIT_CONFIG_PARAMETERS="" git -c x.one=1 config ${mode_prefix}list
 '
 
 test_expect_success 'GIT_CONFIG_PARAMETERS handles old-style entries' '
 	v="${SQ}key.one=foo${SQ}" &&
 	v="$v  ${SQ}key.two=bar${SQ}" &&
 	v="$v ${SQ}key.ambiguous=section.whatever=value${SQ}" &&
-	GIT_CONFIG_PARAMETERS=$v git config --get-regexp "key.*" >actual &&
+	GIT_CONFIG_PARAMETERS=$v git config ${mode_prefix}get-regexp "key.*" >actual &&
 	cat >expect <<-EOF &&
 	key.one foo
 	key.two bar
@@ -1372,7 +1393,7 @@ test_expect_success 'GIT_CONFIG_PARAMETERS handles new-style entries' '
 	v="${SQ}key.one${SQ}=${SQ}foo${SQ}" &&
 	v="$v  ${SQ}key.two${SQ}=${SQ}bar${SQ}" &&
 	v="$v ${SQ}key.ambiguous=section.whatever${SQ}=${SQ}value${SQ}" &&
-	GIT_CONFIG_PARAMETERS=$v git config --get-regexp "key.*" >actual &&
+	GIT_CONFIG_PARAMETERS=$v git config ${mode_prefix}get-regexp "key.*" >actual &&
 	cat >expect <<-EOF &&
 	key.one foo
 	key.two bar
@@ -1386,7 +1407,7 @@ test_expect_success 'old and new-style entries can mix' '
 	v="$v ${SQ}key.newone${SQ}=${SQ}newfoo${SQ}" &&
 	v="$v ${SQ}key.oldtwo=oldbar${SQ}" &&
 	v="$v ${SQ}key.newtwo${SQ}=${SQ}newbar${SQ}" &&
-	GIT_CONFIG_PARAMETERS=$v git config --get-regexp "key.*" >actual &&
+	GIT_CONFIG_PARAMETERS=$v git config ${mode_prefix}get-regexp "key.*" >actual &&
 	cat >expect <<-EOF &&
 	key.oldone oldfoo
 	key.newone newfoo
@@ -1399,7 +1420,7 @@ test_expect_success 'old and new-style entries can mix' '
 test_expect_success 'old and new bools with ambiguous subsection' '
 	v="${SQ}key.with=equals.oldbool${SQ}" &&
 	v="$v ${SQ}key.with=equals.newbool${SQ}=" &&
-	GIT_CONFIG_PARAMETERS=$v git config --get-regexp "key.*" >actual &&
+	GIT_CONFIG_PARAMETERS=$v git config ${mode_prefix}get-regexp "key.*" >actual &&
 	cat >expect <<-EOF &&
 	key.with equals.oldbool
 	key.with=equals.newbool
@@ -1413,7 +1434,7 @@ test_expect_success 'detect bogus GIT_CONFIG_PARAMETERS' '
 	env.two two
 	EOF
 	GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ} ${SQ}env.two=two${SQ}" \
-		git config --get-regexp "env.*" >actual &&
+		git config ${mode_prefix}get-regexp "env.*" >actual &&
 	test_cmp expect actual &&
 
 	cat >expect <<-EOF &&
@@ -1421,12 +1442,12 @@ test_expect_success 'detect bogus GIT_CONFIG_PARAMETERS' '
 	env.two two
 	EOF
 	GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ}\\$SQ$SQ$SQ ${SQ}env.two=two${SQ}" \
-		git config --get-regexp "env.*" >actual &&
+		git config ${mode_prefix}get-regexp "env.*" >actual &&
 	test_cmp expect actual &&
 
 	test_must_fail env \
 		GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ}\\$SQ ${SQ}env.two=two${SQ}" \
-		git config --get-regexp "env.*"
+		git config ${mode_prefix}get-regexp "env.*"
 '
 
 test_expect_success 'git --config-env=key=envvar support' '
@@ -1439,12 +1460,12 @@ test_expect_success 'git --config-env=key=envvar support' '
 	false
 	EOF
 	{
-		ENVVAR=value git --config-env=core.name=ENVVAR config core.name &&
-		ENVVAR=value git --config-env core.name=ENVVAR config core.name &&
-		ENVVAR=value git --config-env=foo.CamelCase=ENVVAR config foo.camelcase &&
-		ENVVAR=value git --config-env foo.CamelCase=ENVVAR config foo.camelcase &&
-		ENVVAR= git --config-env=foo.flag=ENVVAR config --bool foo.flag &&
-		ENVVAR= git --config-env foo.flag=ENVVAR config --bool foo.flag
+		ENVVAR=value git --config-env=core.name=ENVVAR config ${mode_get} core.name &&
+		ENVVAR=value git --config-env core.name=ENVVAR config ${mode_get} core.name &&
+		ENVVAR=value git --config-env=foo.CamelCase=ENVVAR config ${mode_get} foo.camelcase &&
+		ENVVAR=value git --config-env foo.CamelCase=ENVVAR config ${mode_get} foo.camelcase &&
+		ENVVAR= git --config-env=foo.flag=ENVVAR config ${mode_get} --bool foo.flag &&
+		ENVVAR= git --config-env foo.flag=ENVVAR config ${mode_get} --bool foo.flag
 	} >actual &&
 	test_cmp expect actual
 '
@@ -1452,17 +1473,17 @@ test_expect_success 'git --config-env=key=envvar support' '
 test_expect_success 'git --config-env with missing value' '
 	test_must_fail env ENVVAR=value git --config-env 2>error &&
 	grep "no config key given for --config-env" error &&
-	test_must_fail env ENVVAR=value git --config-env config core.name 2>error &&
+	test_must_fail env ENVVAR=value git --config-env config ${mode_get} core.name 2>error &&
 	grep "invalid config format: config" error
 '
 
 test_expect_success 'git --config-env fails with invalid parameters' '
-	test_must_fail git --config-env=foo.flag config --bool foo.flag 2>error &&
+	test_must_fail git --config-env=foo.flag config ${mode_get} --bool foo.flag 2>error &&
 	test_grep "invalid config format: foo.flag" error &&
-	test_must_fail git --config-env=foo.flag= config --bool foo.flag 2>error &&
+	test_must_fail git --config-env=foo.flag= config ${mode_get} --bool foo.flag 2>error &&
 	test_grep "missing environment variable name for configuration ${SQ}foo.flag${SQ}" error &&
 	sane_unset NONEXISTENT &&
-	test_must_fail git --config-env=foo.flag=NONEXISTENT config --bool foo.flag 2>error &&
+	test_must_fail git --config-env=foo.flag=NONEXISTENT config ${mode_get} --bool foo.flag 2>error &&
 	test_grep "missing environment variable ${SQ}NONEXISTENT${SQ} for configuration ${SQ}foo.flag${SQ}" error
 '
 
@@ -1474,7 +1495,7 @@ test_expect_success 'git -c and --config-env work together' '
 	ENVVAR=env-value git \
 		-c bar.cmd=cmd-value \
 		--config-env=bar.env=ENVVAR \
-		config --get-regexp "^bar.*" >actual &&
+		config ${mode_prefix}get-regexp "^bar.*" >actual &&
 	test_cmp expect actual
 '
 
@@ -1484,8 +1505,8 @@ test_expect_success 'git -c and --config-env override each other' '
 	cmd
 	EOF
 	{
-		ENVVAR=env git -c bar.bar=cmd --config-env=bar.bar=ENVVAR config bar.bar &&
-		ENVVAR=env git --config-env=bar.bar=ENVVAR -c bar.bar=cmd config bar.bar
+		ENVVAR=env git -c bar.bar=cmd --config-env=bar.bar=ENVVAR config ${config_get} bar.bar &&
+		ENVVAR=env git --config-env=bar.bar=ENVVAR -c bar.bar=cmd config ${config_get} bar.bar
 	} >actual &&
 	test_cmp expect actual
 '
@@ -1494,7 +1515,7 @@ test_expect_success '--config-env handles keys with equals' '
 	echo value=with=equals >expect &&
 	ENVVAR=value=with=equals git \
 		--config-env=section.subsection=with=equals.key=ENVVAR \
-		config section.subsection=with=equals.key >actual &&
+		config ${config_get} section.subsection=with=equals.key >actual &&
 	test_cmp expect actual
 '
 
@@ -1502,7 +1523,7 @@ test_expect_success 'git config handles environment config pairs' '
 	GIT_CONFIG_COUNT=2 \
 		GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="foo" \
 		GIT_CONFIG_KEY_1="pair.two" GIT_CONFIG_VALUE_1="bar" \
-		git config --get-regexp "pair.*" >actual &&
+		git config ${mode_prefix}get-regexp "pair.*" >actual &&
 	cat >expect <<-EOF &&
 	pair.one foo
 	pair.two bar
@@ -1520,7 +1541,7 @@ test_expect_success 'git config ignores pairs exceeding count' '
 	GIT_CONFIG_COUNT=1 \
 		GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
 		GIT_CONFIG_KEY_1="pair.two" GIT_CONFIG_VALUE_1="value" \
-		git config --get-regexp "pair.*" >actual 2>error &&
+		git config ${mode_prefix}get-regexp "pair.*" >actual 2>error &&
 	cat >expect <<-EOF &&
 	pair.one value
 	EOF
@@ -1531,43 +1552,43 @@ test_expect_success 'git config ignores pairs exceeding count' '
 test_expect_success 'git config ignores pairs with zero count' '
 	test_must_fail env \
 		GIT_CONFIG_COUNT=0 GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
-		git config pair.one 2>error &&
+		git config ${config_get} pair.one 2>error &&
 	test_must_be_empty error
 '
 
 test_expect_success 'git config ignores pairs with empty count' '
 	test_must_fail env \
 		GIT_CONFIG_COUNT= GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
-		git config pair.one 2>error &&
+		git config ${config_get} pair.one 2>error &&
 	test_must_be_empty error
 '
 
 test_expect_success 'git config fails with invalid count' '
-	test_must_fail env GIT_CONFIG_COUNT=10a git config --list 2>error &&
+	test_must_fail env GIT_CONFIG_COUNT=10a git config ${mode_prefix}list 2>error &&
 	test_grep "bogus count" error &&
-	test_must_fail env GIT_CONFIG_COUNT=9999999999999999 git config --list 2>error &&
+	test_must_fail env GIT_CONFIG_COUNT=9999999999999999 git config ${mode_prefix}list 2>error &&
 	test_grep "too many entries" error
 '
 
 test_expect_success 'git config fails with missing config key' '
 	test_must_fail env GIT_CONFIG_COUNT=1 GIT_CONFIG_VALUE_0="value" \
-		git config --list 2>error &&
+		git config ${mode_prefix}list 2>error &&
 	test_grep "missing config key" error
 '
 
 test_expect_success 'git config fails with missing config value' '
 	test_must_fail env GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="pair.one" \
-		git config --list 2>error &&
+		git config ${mode_prefix}list 2>error &&
 	test_grep "missing config value" error
 '
 
 test_expect_success 'git config fails with invalid config pair key' '
 	test_must_fail env GIT_CONFIG_COUNT=1 \
 		GIT_CONFIG_KEY_0= GIT_CONFIG_VALUE_0=value \
-		git config --list &&
+		git config ${mode_prefix}list &&
 	test_must_fail env GIT_CONFIG_COUNT=1 \
 		GIT_CONFIG_KEY_0=missing-section GIT_CONFIG_VALUE_0=value \
-		git config --list
+		git config ${mode_prefix}list
 '
 
 test_expect_success 'environment overrides config file' '
@@ -1577,7 +1598,7 @@ test_expect_success 'environment overrides config file' '
 	one = value
 	EOF
 	GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=pair.one GIT_CONFIG_VALUE_0=override \
-		git config pair.one >actual &&
+		git config ${mode_get} pair.one >actual &&
 	cat >expect <<-EOF &&
 	override
 	EOF
@@ -1587,7 +1608,7 @@ test_expect_success 'environment overrides config file' '
 test_expect_success 'GIT_CONFIG_PARAMETERS overrides environment config' '
 	GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=pair.one GIT_CONFIG_VALUE_0=value \
 		GIT_CONFIG_PARAMETERS="${SQ}pair.one=override${SQ}" \
-		git config pair.one >actual &&
+		git config ${mode_get} pair.one >actual &&
 	cat >expect <<-EOF &&
 	override
 	EOF
@@ -1596,7 +1617,7 @@ test_expect_success 'GIT_CONFIG_PARAMETERS overrides environment config' '
 
 test_expect_success 'command line overrides environment config' '
 	GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=pair.one GIT_CONFIG_VALUE_0=value \
-		git -c pair.one=override config pair.one >actual &&
+		git -c pair.one=override config ${mode_get} pair.one >actual &&
 	cat >expect <<-EOF &&
 	override
 	EOF
@@ -1606,8 +1627,8 @@ test_expect_success 'command line overrides environment config' '
 test_expect_success 'git config --edit works' '
 	git config -f tmp test.value no &&
 	echo test.value=yes >expect &&
-	GIT_EDITOR="echo [test]value=yes >" git config -f tmp --edit &&
-	git config -f tmp --list >actual &&
+	GIT_EDITOR="echo [test]value=yes >" git config ${mode_prefix}edit -f tmp &&
+	git config ${mode_prefix}list -f tmp >actual &&
 	test_cmp expect actual
 '
 
@@ -1615,8 +1636,8 @@ test_expect_success 'git config --edit respects core.editor' '
 	git config -f tmp test.value no &&
 	echo test.value=yes >expect &&
 	test_config core.editor "echo [test]value=yes >" &&
-	git config -f tmp --edit &&
-	git config -f tmp --list >actual &&
+	git config ${mode_prefix}edit -f tmp &&
+	git config ${mode_prefix}list -f tmp >actual &&
 	test_cmp expect actual
 '
 
@@ -1627,7 +1648,7 @@ test_expect_success 'barf on syntax error' '
 	[section]
 	key garbage
 	EOF
-	test_must_fail git config --get section.key 2>error &&
+	test_must_fail git config ${mode_prefix}get section.key 2>error &&
 	test_grep " line 3 " error
 '
 
@@ -1637,7 +1658,7 @@ test_expect_success 'barf on incomplete section header' '
 	[section
 	key = value
 	EOF
-	test_must_fail git config --get section.key 2>error &&
+	test_must_fail git config ${mode_prefix}get section.key 2>error &&
 	test_grep " line 2 " error
 '
 
@@ -1647,7 +1668,7 @@ test_expect_success 'barf on incomplete string' '
 	[section]
 	key = "value string
 	EOF
-	test_must_fail git config --get section.key 2>error &&
+	test_must_fail git config ${mode_prefix}get section.key 2>error &&
 	test_grep " line 3 " error
 '
 
@@ -1660,22 +1681,22 @@ test_expect_success 'urlmatch' '
 		cookieFile = /tmp/cookie.txt
 	EOF
 
-	test_expect_code 1 git config --bool --get-urlmatch doesnt.exist https://good.example.com >actual &&
+	test_expect_code 1 git config ${mode_prefix}get-urlmatch --bool doesnt.exist https://good.example.com >actual &&
 	test_must_be_empty actual &&
 
 	echo true >expect &&
-	git config --bool --get-urlmatch http.SSLverify https://good.example.com >actual &&
+	git config ${mode_prefix}get-urlmatch --bool http.SSLverify https://good.example.com >actual &&
 	test_cmp expect actual &&
 
 	echo false >expect &&
-	git config --bool --get-urlmatch http.sslverify https://weak.example.com >actual &&
+	git config ${mode_prefix}get-urlmatch --bool http.sslverify https://weak.example.com >actual &&
 	test_cmp expect actual &&
 
 	{
 		echo http.cookiefile /tmp/cookie.txt &&
 		echo http.sslverify false
 	} >expect &&
-	git config --get-urlmatch HTTP https://weak.example.com >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://weak.example.com >actual &&
 	test_cmp expect actual
 '
 
@@ -1690,7 +1711,7 @@ test_expect_success 'urlmatch with --show-scope' '
 	local	http.cookiefile /tmp/cookie.txt
 	local	http.sslverify false
 	EOF
-	git config --get-urlmatch --show-scope HTTP https://weak.example.com >actual &&
+	git config ${mode_prefix}get-urlmatch --show-scope HTTP https://weak.example.com >actual &&
 	test_cmp expect actual
 '
 
@@ -1721,47 +1742,47 @@ test_expect_success 'urlmatch favors more specific URLs' '
 	EOF
 
 	echo http.cookiefile /tmp/root.txt >expect &&
-	git config --get-urlmatch HTTP https://example.com >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://example.com >actual &&
 	test_cmp expect actual &&
 
 	echo http.cookiefile /tmp/subdirectory.txt >expect &&
-	git config --get-urlmatch HTTP https://example.com/subdirectory >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://example.com/subdirectory >actual &&
 	test_cmp expect actual &&
 
 	echo http.cookiefile /tmp/subdirectory.txt >expect &&
-	git config --get-urlmatch HTTP https://example.com/subdirectory/nested >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://example.com/subdirectory/nested >actual &&
 	test_cmp expect actual &&
 
 	echo http.cookiefile /tmp/user.txt >expect &&
-	git config --get-urlmatch HTTP https://user@xxxxxxxxxxx/ >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://user@xxxxxxxxxxx/ >actual &&
 	test_cmp expect actual &&
 
 	echo http.cookiefile /tmp/subdirectory.txt >expect &&
-	git config --get-urlmatch HTTP https://averylonguser@xxxxxxxxxxx/subdirectory >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://averylonguser@xxxxxxxxxxx/subdirectory >actual &&
 	test_cmp expect actual &&
 
 	echo http.cookiefile /tmp/preceding.txt >expect &&
-	git config --get-urlmatch HTTP https://preceding.example.com >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://preceding.example.com >actual &&
 	test_cmp expect actual &&
 
 	echo http.cookiefile /tmp/wildcard.txt >expect &&
-	git config --get-urlmatch HTTP https://wildcard.example.com >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://wildcard.example.com >actual &&
 	test_cmp expect actual &&
 
 	echo http.cookiefile /tmp/sub.txt >expect &&
-	git config --get-urlmatch HTTP https://sub.example.com/wildcardwithsubdomain >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://sub.example.com/wildcardwithsubdomain >actual &&
 	test_cmp expect actual &&
 
 	echo http.cookiefile /tmp/trailing.txt >expect &&
-	git config --get-urlmatch HTTP https://trailing.example.com >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://trailing.example.com >actual &&
 	test_cmp expect actual &&
 
 	echo http.cookiefile /tmp/sub.txt >expect &&
-	git config --get-urlmatch HTTP https://user@xxxxxxxxxxxxxxx >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://user@xxxxxxxxxxxxxxx >actual &&
 	test_cmp expect actual &&
 
 	echo http.cookiefile /tmp/multiwildcard.txt >expect &&
-	git config --get-urlmatch HTTP https://wildcard.example.org >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://wildcard.example.org >actual &&
 	test_cmp expect actual
 '
 
@@ -1774,34 +1795,34 @@ test_expect_success 'urlmatch with wildcard' '
 		cookieFile = /tmp/cookie.txt
 	EOF
 
-	test_expect_code 1 git config --bool --get-urlmatch doesnt.exist https://good.example.com >actual &&
+	test_expect_code 1 git config ${mode_prefix}get-urlmatch --bool doesnt.exist https://good.example.com >actual &&
 	test_must_be_empty actual &&
 
 	echo true >expect &&
-	git config --bool --get-urlmatch http.SSLverify https://example.com >actual &&
+	git config ${mode_prefix}get-urlmatch --bool http.SSLverify https://example.com >actual &&
 	test_cmp expect actual &&
 
 	echo true >expect &&
-	git config --bool --get-urlmatch http.SSLverify https://good-example.com >actual &&
+	git config ${mode_prefix}get-urlmatch --bool http.SSLverify https://good-example.com >actual &&
 	test_cmp expect actual &&
 
 	echo true >expect &&
-	git config --bool --get-urlmatch http.sslverify https://deep.nested.example.com >actual &&
+	git config ${mode_prefix}get-urlmatch --bool http.sslverify https://deep.nested.example.com >actual &&
 	test_cmp expect actual &&
 
 	echo false >expect &&
-	git config --bool --get-urlmatch http.sslverify https://good.example.com >actual &&
+	git config ${mode_prefix}get-urlmatch --bool http.sslverify https://good.example.com >actual &&
 	test_cmp expect actual &&
 
 	{
 		echo http.cookiefile /tmp/cookie.txt &&
 		echo http.sslverify false
 	} >expect &&
-	git config --get-urlmatch HTTP https://good.example.com >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://good.example.com >actual &&
 	test_cmp expect actual &&
 
 	echo http.sslverify >expect &&
-	git config --get-urlmatch HTTP https://more.example.com.au >actual &&
+	git config ${mode_prefix}get-urlmatch HTTP https://more.example.com.au >actual &&
 	test_cmp expect actual
 '
 
@@ -1828,7 +1849,7 @@ test_expect_success '--unset last key removes section (except if commented)' '
 	# please be careful when you update the above variable
 	EOF
 
-	git config --unset section.key &&
+	git config ${mode_prefix}unset section.key &&
 	test_cmp expect .git/config &&
 
 	cat >.git/config <<-\EOF &&
@@ -1841,7 +1862,7 @@ test_expect_success '--unset last key removes section (except if commented)' '
 	[next-section]
 	EOF
 
-	git config --unset section.key &&
+	git config ${mode_prefix}unset section.key &&
 	test_cmp expect .git/config &&
 
 	q_to_tab >.git/config <<-\EOF &&
@@ -1851,7 +1872,7 @@ test_expect_success '--unset last key removes section (except if commented)' '
 	[two]
 	key = true
 	EOF
-	git config --unset two.key &&
+	git config ${mode_prefix}unset two.key &&
 	! grep two .git/config &&
 
 	q_to_tab >.git/config <<-\EOF &&
@@ -1861,7 +1882,7 @@ test_expect_success '--unset last key removes section (except if commented)' '
 	[one]
 	key = true
 	EOF
-	git config --unset-all one.key &&
+	git config ${mode_prefix}unset-all one.key &&
 	test_line_count = 0 .git/config &&
 
 	q_to_tab >.git/config <<-\EOF &&
@@ -1871,7 +1892,7 @@ test_expect_success '--unset last key removes section (except if commented)' '
 	[two]
 	Qkey = true
 	EOF
-	git config --unset two.key &&
+	git config ${mode_prefix}unset two.key &&
 	grep two .git/config &&
 
 	q_to_tab >.git/config <<-\EOF &&
@@ -1883,7 +1904,7 @@ test_expect_success '--unset last key removes section (except if commented)' '
 	[TWO "subsection"]
 	[one]
 	EOF
-	git config --unset two.subsection.key &&
+	git config ${mode_prefix}unset two.subsection.key &&
 	test "not [two subsection]" = "$(git config one.key)" &&
 	test_line_count = 3 .git/config
 '
@@ -1895,7 +1916,7 @@ test_expect_success '--unset-all removes section if empty & uncommented' '
 	key = value2
 	EOF
 
-	git config --unset-all section.key &&
+	git config ${mode_prefix}unset-all section.key &&
 	test_line_count = 0 .git/config
 '
 
@@ -1909,7 +1930,7 @@ test_expect_success 'adding a key into an empty section reuses header' '
 	Qkey = value
 	EOF
 
-	git config section.key value &&
+	git config ${mode_set} section.key value &&
 	test_cmp expect .git/config
 '
 
@@ -1918,7 +1939,7 @@ test_expect_success POSIXPERM,PERL 'preserves existing permissions' '
 	git config imap.pass Hunter2 &&
 	perl -e \
 	  "die q(badset) if ((stat(q(.git/config)))[2] & 07777) != 0600" &&
-	git config --rename-section imap pop &&
+	git config ${mode_prefix}rename-section imap pop &&
 	perl -e \
 	  "die q(badrename) if ((stat(q(.git/config)))[2] & 07777) != 0600"
 '
@@ -1967,7 +1988,7 @@ test_expect_success '--show-origin with --list' '
 	command line:	user.cmdline=true
 	EOF
 	GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=user.environ GIT_CONFIG_VALUE_0=true\
-		git -c user.cmdline=true config --list --show-origin >output &&
+		git -c user.cmdline=true config ${mode_prefix}list --show-origin >output &&
 	test_cmp expect output
 '
 
@@ -1984,7 +2005,7 @@ test_expect_success '--show-origin with --list --null' '
 	includeQcommand line:Quser.cmdline
 	trueQ
 	EOF
-	git -c user.cmdline=true config --null --list --show-origin >output.raw &&
+	git -c user.cmdline=true config ${mode_prefix}list --null --show-origin >output.raw &&
 	nul_to_q <output.raw >output &&
 	# The here-doc above adds a newline that the --null output would not
 	# include. Add it here to make the two comparable.
@@ -1998,7 +2019,7 @@ test_expect_success '--show-origin with single file' '
 	file:.git/config	user.override=local
 	file:.git/config	include.path=../include/relative.include
 	EOF
-	git config --local --list --show-origin >output &&
+	git config ${mode_prefix}list --local --show-origin >output &&
 	test_cmp expect output
 '
 
@@ -2007,7 +2028,7 @@ test_expect_success '--show-origin with --get-regexp' '
 	file:$HOME/.gitconfig	user.global true
 	file:.git/config	user.local true
 	EOF
-	git config --show-origin --get-regexp "user\.[g|l].*" >output &&
+	git config ${mode_prefix}get-regexp --show-origin "user\.[g|l].*" >output &&
 	test_cmp expect output
 '
 
@@ -2015,7 +2036,7 @@ test_expect_success '--show-origin getting a single key' '
 	cat >expect <<-\EOF &&
 	file:.git/config	local
 	EOF
-	git config --show-origin user.override >output &&
+	git config ${mode_get} --show-origin user.override >output &&
 	test_cmp expect output
 '
 
@@ -2036,7 +2057,7 @@ test_expect_success !MINGW '--show-origin escape special file name characters' '
 	cat >expect <<-\EOF &&
 	file:"file\" (dq) and spaces.conf"	user.custom=true
 	EOF
-	git config --file "$WEIRDLY_NAMED_FILE" --show-origin --list >output &&
+	git config ${mode_prefix}list --file "$WEIRDLY_NAMED_FILE" --show-origin >output &&
 	test_cmp expect output
 '
 
@@ -2044,7 +2065,7 @@ test_expect_success '--show-origin stdin' '
 	cat >expect <<-\EOF &&
 	standard input:	user.custom=true
 	EOF
-	git config --file - --show-origin --list <"$CUSTOM_CONFIG_FILE" >output &&
+	git config ${mode_prefix}list --file - --show-origin <"$CUSTOM_CONFIG_FILE" >output &&
 	test_cmp expect output
 '
 
@@ -2057,7 +2078,7 @@ test_expect_success '--show-origin stdin with file include' '
 	file:$INCLUDE_DIR/stdin.include	include
 	EOF
 	echo "[include]path=\"$INCLUDE_DIR\"/stdin.include" |
-	git config --show-origin --includes --file - user.stdin >output &&
+	git config ${mode_get} --show-origin --includes --file - user.stdin >output &&
 
 	test_cmp expect output
 '
@@ -2071,7 +2092,7 @@ test_expect_success '--show-origin blob' '
 		cat >expect <<-EOF &&
 		blob:$blob	user.custom=true
 		EOF
-		git config --blob=$blob --show-origin --list >output &&
+		git config ${mode_prefix}list --blob=$blob --show-origin >output &&
 		test_cmp expect output
 	)
 '
@@ -2087,13 +2108,13 @@ test_expect_success '--show-origin blob ref' '
 		cp "$CUSTOM_CONFIG_FILE" custom.conf &&
 		git add custom.conf &&
 		git commit -m "new config file" &&
-		git config --blob=main:custom.conf --show-origin --list >output &&
+		git config ${mode_prefix}list --blob=main:custom.conf --show-origin >output &&
 		test_cmp expect output
 	)
 '
 
 test_expect_success '--show-origin with --default' '
-	git config --show-origin --default foo some.key >actual &&
+	git config ${mode_get} --show-origin --default foo some.key >actual &&
 	echo "command line:	foo" >expect &&
 	test_cmp expect actual
 '
@@ -2113,13 +2134,14 @@ test_expect_success '--show-scope with --list' '
 	worktree	user.worktree=true
 	command	user.cmdline=true
 	EOF
+	test_when_finished "git worktree remove wt1" &&
 	git worktree add wt1 &&
 	# We need these to test for worktree scope, but outside of this
 	# test, this is just noise
 	test_config core.repositoryformatversion 1 &&
 	test_config extensions.worktreeConfig true &&
-	git config --worktree user.worktree true &&
-	git -c user.cmdline=true config --list --show-scope >output &&
+	git config ${mode_get} --worktree user.worktree true &&
+	git -c user.cmdline=true config ${mode_prefix}list --show-scope >output &&
 	test_cmp expect output
 '
 
@@ -2128,7 +2150,7 @@ test_expect_success !MINGW '--show-scope with --blob' '
 	cat >expect <<-EOF &&
 	command	user.custom=true
 	EOF
-	git config --blob=$blob --show-scope --list >output &&
+	git config ${mode_prefix}list --blob=$blob --show-scope >output &&
 	test_cmp expect output
 '
 
@@ -2138,7 +2160,7 @@ test_expect_success '--show-scope with --local' '
 	local	user.override=local
 	local	include.path=../include/relative.include
 	EOF
-	git config --local --list --show-scope >output &&
+	git config ${mode_prefix}list --local --show-scope >output &&
 	test_cmp expect output
 '
 
@@ -2146,7 +2168,7 @@ test_expect_success '--show-scope getting a single value' '
 	cat >expect <<-\EOF &&
 	local	true
 	EOF
-	git config --show-scope --get user.local >output &&
+	git config ${mode_prefix}get --show-scope user.local >output &&
 	test_cmp expect output
 '
 
@@ -2162,12 +2184,12 @@ test_expect_success '--show-scope with --show-origin' '
 	local	file:.git/../include/relative.include	user.relative=include
 	command	command line:	user.cmdline=true
 	EOF
-	git -c user.cmdline=true config --list --show-origin --show-scope >output &&
+	git -c user.cmdline=true config ${mode_prefix}list --show-origin --show-scope >output &&
 	test_cmp expect output
 '
 
 test_expect_success '--show-scope with --default' '
-	git config --show-scope --default foo some.key >actual &&
+	git config ${mode_get} --show-scope --default foo some.key >actual &&
 	echo "command	foo" >expect &&
 	test_cmp expect actual
 '
@@ -2203,7 +2225,7 @@ test_expect_success 'override global and system config' '
 	global	home.config=true
 	local	local.config=true
 	EOF
-	git config --show-scope --list >output &&
+	git config ${mode_prefix}list --show-scope >output &&
 	test_cmp expect output &&
 
 	cat >expect <<-EOF &&
@@ -2212,20 +2234,20 @@ test_expect_success 'override global and system config' '
 	local	local.config=true
 	EOF
 	GIT_CONFIG_NOSYSTEM=false GIT_CONFIG_SYSTEM=custom-system-config GIT_CONFIG_GLOBAL=custom-global-config \
-		git config --show-scope --list >output &&
+		git config ${mode_prefix}list --show-scope >output &&
 	test_cmp expect output &&
 
 	cat >expect <<-EOF &&
 	local	local.config=true
 	EOF
 	GIT_CONFIG_NOSYSTEM=false GIT_CONFIG_SYSTEM=/dev/null GIT_CONFIG_GLOBAL=/dev/null \
-		git config --show-scope --list >output &&
+		git config ${mode_prefix}list --show-scope >output &&
 	test_cmp expect output
 '
 
 test_expect_success 'override global and system config with missing file' '
-	test_must_fail env GIT_CONFIG_GLOBAL=does-not-exist GIT_CONFIG_SYSTEM=/dev/null git config --global --list &&
-	test_must_fail env GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=does-not-exist git config --system --list &&
+	test_must_fail env GIT_CONFIG_GLOBAL=does-not-exist GIT_CONFIG_SYSTEM=/dev/null git config ${mode_prefix}list --global &&
+	test_must_fail env GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=does-not-exist git config ${mode_prefix}list --system &&
 	GIT_CONFIG_GLOBAL=does-not-exist GIT_CONFIG_SYSTEM=does-not-exist git version
 '
 
@@ -2251,10 +2273,10 @@ test_expect_success 'write to overridden global and system config' '
 	key = value
 EOF
 
-	GIT_CONFIG_GLOBAL=write-to-global git config --global config.key value &&
+	GIT_CONFIG_GLOBAL=write-to-global git config ${mode_set} --global config.key value &&
 	test_cmp expect write-to-global &&
 
-	GIT_CONFIG_SYSTEM=write-to-system git config --system config.key value &&
+	GIT_CONFIG_SYSTEM=write-to-system git config ${mode_set} --system config.key value &&
 	test_cmp expect write-to-system
 '
 
@@ -2263,7 +2285,7 @@ do
 	test_expect_success "$opt requires a repo" '
 		# we expect 128 to ensure that we do not simply
 		# fail to find anything and return code "1"
-		test_expect_code 128 nongit git config $opt foo.bar
+		test_expect_code 128 nongit git config ${mode_get} $opt foo.bar
 	'
 done
 
@@ -2287,17 +2309,17 @@ test_expect_success 'identical mixed --type specifiers are allowed' '
 '
 
 test_expect_success 'non-identical modern --type specifiers are not allowed' '
-	test_must_fail git config --type=int --type=bool section.big 2>error &&
+	test_must_fail git config ${mode_get} --type=int --type=bool section.big 2>error &&
 	test_grep "only one type at a time" error
 '
 
 test_expect_success 'non-identical legacy --type specifiers are not allowed' '
-	test_must_fail git config --int --bool section.big 2>error &&
+	test_must_fail git config ${mode_get} --int --bool section.big 2>error &&
 	test_grep "only one type at a time" error
 '
 
 test_expect_success 'non-identical mixed --type specifiers are not allowed' '
-	test_must_fail git config --type=int --bool section.big 2>error &&
+	test_must_fail git config ${mode_get} --type=int --bool section.big 2>error &&
 	test_grep "only one type at a time" error
 '
 
@@ -2314,12 +2336,12 @@ test_expect_success 'unset type specifiers may be reset to conflicting ones' '
 '
 
 test_expect_success '--type rejects unknown specifiers' '
-	test_must_fail git config --type=nonsense section.foo 2>error &&
+	test_must_fail git config ${mode_get} --type=nonsense section.foo 2>error &&
 	test_grep "unrecognized --type argument" error
 '
 
 test_expect_success '--type=int requires at least one digit' '
-	test_must_fail git config --type int --default m some.key >out 2>error &&
+	test_must_fail git config ${mode_get} --type int --default m some.key >out 2>error &&
 	grep "bad numeric config value" error &&
 	test_must_be_empty out
 '
@@ -2341,18 +2363,18 @@ test_expect_success '--replace-all does not invent newlines' '
 	[abc]
 	Qkey = b
 	EOF
-	git config --replace-all abc.key b &&
+	git config ${mode_prefix}replace-all abc.key b &&
 	test_cmp expect .git/config
 '
 
 test_expect_success 'set all config with value-pattern' '
 	test_when_finished rm -f config initial &&
-	git config --file=initial abc.key one &&
+	git config ${mode_set} --file=initial abc.key one &&
 
 	# no match => add new entry
 	cp initial config &&
-	git config --file=config abc.key two a+ &&
-	git config --file=config --list >actual &&
+	git config ${mode_set_all} --file=config abc.key two a+ &&
+	git config ${mode_prefix}list --file=config >actual &&
 	cat >expect <<-\EOF &&
 	abc.key=one
 	abc.key=two
@@ -2360,12 +2382,12 @@ test_expect_success 'set all config with value-pattern' '
 	test_cmp expect actual &&
 
 	# multiple matches => failure
-	test_must_fail git config --file=config abc.key three o+ 2>err &&
+	test_must_fail git config ${mode_set_all} --file=config abc.key three o+ 2>err &&
 	test_grep "has multiple values" err &&
 
 	# multiple values, no match => add
-	git config --file=config abc.key three a+ &&
-	git config --file=config --list >actual &&
+	git config ${mode_set_all} --file=config abc.key three a+ &&
+	git config ${mode_prefix}list --file=config >actual &&
 	cat >expect <<-\EOF &&
 	abc.key=one
 	abc.key=two
@@ -2374,8 +2396,8 @@ test_expect_success 'set all config with value-pattern' '
 	test_cmp expect actual &&
 
 	# single match => replace
-	git config --file=config abc.key four h+ &&
-	git config --file=config --list >actual &&
+	git config ${mode_set_all} --file=config abc.key four h+ &&
+	git config ${mode_prefix}list --file=config >actual &&
 	cat >expect <<-\EOF &&
 	abc.key=one
 	abc.key=two
@@ -2386,11 +2408,11 @@ test_expect_success 'set all config with value-pattern' '
 
 test_expect_success '--replace-all and value-pattern' '
 	test_when_finished rm -f config &&
-	git config --file=config --add abc.key one &&
-	git config --file=config --add abc.key two &&
-	git config --file=config --add abc.key three &&
-	git config --file=config --replace-all abc.key four "o+" &&
-	git config --file=config --list >actual &&
+	git config ${mode_prefix}add --file=config abc.key one &&
+	git config ${mode_prefix}add --file=config abc.key two &&
+	git config ${mode_prefix}add --file=config abc.key three &&
+	git config ${mode_prefix}replace-all --file=config abc.key four "o+" &&
+	git config ${mode_prefix}list --file=config >actual &&
 	cat >expect <<-\EOF &&
 	abc.key=four
 	abc.key=three
@@ -2403,33 +2425,33 @@ test_expect_success 'refuse --fixed-value for incompatible actions' '
 	git config --file=config dev.null bogus &&
 
 	# These modes do not allow --fixed-value at all
-	test_must_fail git config --file=config --fixed-value --add dev.null bogus &&
-	test_must_fail git config --file=config --fixed-value --get-urlmatch dev.null bogus &&
-	test_must_fail git config --file=config --fixed-value --get-urlmatch dev.null bogus &&
-	test_must_fail git config --file=config --fixed-value --rename-section dev null &&
-	test_must_fail git config --file=config --fixed-value --remove-section dev &&
-	test_must_fail git config --file=config --fixed-value --list &&
-	test_must_fail git config --file=config --fixed-value --get-color dev.null &&
-	test_must_fail git config --file=config --fixed-value --get-colorbool dev.null &&
+	test_must_fail git config ${mode_prefix}add --file=config --fixed-value dev.null bogus &&
+	test_must_fail git config ${mode_prefix}get-urlmatch --file=config --fixed-value dev.null bogus &&
+	test_must_fail git config ${mode_prefix}get-urlmatch --file=config --fixed-value dev.null bogus &&
+	test_must_fail git config ${mode_prefix}rename-section --file=config --fixed-value dev null &&
+	test_must_fail git config ${mode_prefix}remove-section --file=config --fixed-value dev &&
+	test_must_fail git config ${mode_prefix}list --file=config --fixed-value &&
+	test_must_fail git config ${mode_prefix}get-color --file=config --fixed-value dev.null &&
+	test_must_fail git config ${mode_prefix}get-colorbool --file=config --fixed-value dev.null &&
 
 	# These modes complain when --fixed-value has no value-pattern
-	test_must_fail git config --file=config --fixed-value dev.null bogus &&
-	test_must_fail git config --file=config --fixed-value --replace-all dev.null bogus &&
-	test_must_fail git config --file=config --fixed-value --get dev.null &&
-	test_must_fail git config --file=config --fixed-value --get-all dev.null &&
-	test_must_fail git config --file=config --fixed-value --get-regexp "dev.*" &&
-	test_must_fail git config --file=config --fixed-value --unset dev.null &&
-	test_must_fail git config --file=config --fixed-value --unset-all dev.null
+	test_must_fail git config ${mode_set} --file=config --fixed-value dev.null bogus &&
+	test_must_fail git config ${mode_prefix}replace-all --file=config --fixed-value dev.null bogus &&
+	test_must_fail git config ${mode_prefix}get --file=config --fixed-value dev.null &&
+	test_must_fail git config ${mode_prefix}get-all --file=config --fixed-value dev.null &&
+	test_must_fail git config ${mode_prefix}get-regexp --file=config --fixed-value "dev.*" &&
+	test_must_fail git config ${mode_prefix}unset --file=config --fixed-value dev.null &&
+	test_must_fail git config ${mode_prefix}unset-all --file=config --fixed-value dev.null
 '
 
 test_expect_success '--fixed-value uses exact string matching' '
 	test_when_finished rm -f config initial &&
 	META="a+b*c?d[e]f.g" &&
-	git config --file=initial fixed.test "$META" &&
+	git config ${mode_set} --file=initial fixed.test "$META" &&
 
 	cp initial config &&
-	git config --file=config fixed.test bogus "$META" &&
-	git config --file=config --list >actual &&
+	git config ${mode_set_all} --file=config fixed.test bogus "$META" &&
+	git config ${mode_prefix}list --file=config >actual &&
 	cat >expect <<-EOF &&
 	fixed.test=$META
 	fixed.test=bogus
@@ -2437,34 +2459,34 @@ test_expect_success '--fixed-value uses exact string matching' '
 	test_cmp expect actual &&
 
 	cp initial config &&
-	git config --file=config --fixed-value fixed.test bogus "$META" &&
-	git config --file=config --list >actual &&
+	git config ${mode_set_all} --file=config --fixed-value fixed.test bogus "$META" &&
+	git config ${mode_prefix}list --file=config >actual &&
 	cat >expect <<-\EOF &&
 	fixed.test=bogus
 	EOF
 	test_cmp expect actual &&
 
 	cp initial config &&
-	test_must_fail git config --file=config --unset fixed.test "$META" &&
-	git config --file=config --fixed-value --unset fixed.test "$META" &&
-	test_must_fail git config --file=config fixed.test &&
+	test_must_fail git config ${mode_prefix}unset --file=config fixed.test "$META" &&
+	git config ${mode_prefix}unset --file=config --fixed-value fixed.test "$META" &&
+	test_must_fail git config ${mode_get} --file=config fixed.test &&
 
 	cp initial config &&
-	test_must_fail git config --file=config --unset-all fixed.test "$META" &&
-	git config --file=config --fixed-value --unset-all fixed.test "$META" &&
-	test_must_fail git config --file=config fixed.test &&
+	test_must_fail git config ${mode_prefix}unset-all --file=config fixed.test "$META" &&
+	git config ${mode_prefix}unset-all --file=config --fixed-value fixed.test "$META" &&
+	test_must_fail git config ${mode_get} --file=config fixed.test &&
 
 	cp initial config &&
-	git config --file=config --replace-all fixed.test bogus "$META" &&
-	git config --file=config --list >actual &&
+	git config ${mode_prefix}replace-all --file=config fixed.test bogus "$META" &&
+	git config ${mode_prefix}list --file=config >actual &&
 	cat >expect <<-EOF &&
 	fixed.test=$META
 	fixed.test=bogus
 	EOF
 	test_cmp expect actual &&
 
-	git config --file=config --fixed-value --replace-all fixed.test bogus "$META" &&
-	git config --file=config --list >actual &&
+	git config ${mode_prefix}replace-all --file=config --fixed-value fixed.test bogus "$META" &&
+	git config ${mode_prefix}list --file=config >actual &&
 	cat >expect <<-EOF &&
 	fixed.test=bogus
 	fixed.test=bogus
@@ -2475,23 +2497,23 @@ test_expect_success '--fixed-value uses exact string matching' '
 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 ${mode_set} --file=config fixed.test bogus &&
+	git config ${mode_prefix}add --file=config 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 ${mode_prefix}get --file=config fixed.test bogus &&
+	test_must_fail git config ${mode_prefix}get --file=config fixed.test "$META" &&
+	git config ${mode_prefix}get --file=config --fixed-value fixed.test "$META" &&
+	test_must_fail git config ${mode_prefix}get --file=config --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 ${mode_prefix}get-all --file=config fixed.test bogus &&
+	test_must_fail git config ${mode_prefix}get-all --file=config fixed.test "$META" &&
+	git config ${mode_prefix}get-all --file=config --fixed-value fixed.test "$META" &&
+	test_must_fail git config ${mode_prefix}get-all --file=config --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
+	git config ${mode_prefix}get-regexp --file=config fixed+ bogus &&
+	test_must_fail git config ${mode_prefix}get-regexp --file=config fixed+ "$META" &&
+	git config ${mode_prefix}get-regexp --file=config --fixed-value fixed+ "$META" &&
+	test_must_fail git config ${mode_prefix}get-regexp --file=config --fixed-value fixed+ non-existent
 '
 
 test_expect_success 'includeIf.hasconfig:remote.*.url' '
@@ -2516,10 +2538,10 @@ test_expect_success 'includeIf.hasconfig:remote.*.url' '
 	EOF
 
 	echo this-is-included >expect-this &&
-	git -C hasremoteurlTest config --get user.this >actual-this &&
+	git -C hasremoteurlTest config ${mode_prefix}get user.this >actual-this &&
 	test_cmp expect-this actual-this &&
 
-	test_must_fail git -C hasremoteurlTest config --get user.that
+	test_must_fail git -C hasremoteurlTest config ${mode_prefix}get user.that
 '
 
 test_expect_success 'includeIf.hasconfig:remote.*.url respects last-config-wins' '
@@ -2546,13 +2568,13 @@ test_expect_success 'includeIf.hasconfig:remote.*.url respects last-config-wins'
 	echo main-config >expect-main-config &&
 	echo included-config >expect-included-config &&
 
-	git -C hasremoteurlTest config --get user.one >actual &&
+	git -C hasremoteurlTest config ${mode_prefix}get user.one >actual &&
 	test_cmp expect-main-config actual &&
 
-	git -C hasremoteurlTest config --get user.two >actual &&
+	git -C hasremoteurlTest config ${mode_prefix}get user.two >actual &&
 	test_cmp expect-included-config actual &&
 
-	git -C hasremoteurlTest config --get user.three >actual &&
+	git -C hasremoteurlTest config ${mode_prefix}get user.three >actual &&
 	test_cmp expect-main-config actual
 '
 
@@ -2587,11 +2609,11 @@ test_expect_success 'includeIf.hasconfig:remote.*.url globs' '
 		path = "$(pwd)/no"
 	EOF
 
-	git -C hasremoteurlTest config --get user.dss &&
-	git -C hasremoteurlTest config --get user.dse &&
-	git -C hasremoteurlTest config --get user.dsm &&
-	git -C hasremoteurlTest config --get user.ssm &&
-	test_must_fail git -C hasremoteurlTest config --get user.no
+	git -C hasremoteurlTest config ${mode_prefix}get user.dss &&
+	git -C hasremoteurlTest config ${mode_prefix}get user.dse &&
+	git -C hasremoteurlTest config ${mode_prefix}get user.dsm &&
+	git -C hasremoteurlTest config ${mode_prefix}get user.ssm &&
+	test_must_fail git -C hasremoteurlTest config ${mode_prefix}get user.no
 '
 
 test_expect_success 'includeIf.hasconfig:remote.*.url forbids remote url in such included files' '
@@ -2625,4 +2647,11 @@ test_expect_success 'specifying multiple modes causes failure' '
 	test_cmp expect err
 '
 
+test_expect_success 'specifying mode and subcommand causes failure' '
+	test_must_fail git config get --get 2>err &&
+	grep "subcommand and action modes are incompatible" err
+'
+
+done
+
 test_done
-- 
2.44.0

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux