Skip to content

Commit 417be08

Browse files
ROGERSM94gitster
authored andcommitted
t1300: create custom config file without special characters
Tests that required a custom configuration file to be created previously used a file with non-alphanumeric characters including escaped double quotes. This is not really necessary for the majority of tests involving custom config files, and decreases test coverage on systems that dissallow such filenames (Windows, etc.). Create two files, one appropriate for testing quoting and one appropriate for general use. Signed-off-by: Matthew Rogers <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3de7ee3 commit 417be08

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

t/t1300-config.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,18 +1710,23 @@ test_expect_success '--show-origin getting a single key' '
17101710
'
17111711

17121712
test_expect_success 'set up custom config file' '
1713-
CUSTOM_CONFIG_FILE="file\" (dq) and spaces.conf" &&
1713+
CUSTOM_CONFIG_FILE="custom.conf" &&
17141714
cat >"$CUSTOM_CONFIG_FILE" <<-\EOF
17151715
[user]
17161716
custom = true
17171717
EOF
17181718
'
17191719

1720+
test_expect_success !MINGW 'set up custom config file with special name characters' '
1721+
WEIRDLY_NAMED_FILE="file\" (dq) and spaces.conf" &&
1722+
cp "$CUSTOM_CONFIG_FILE" "$WEIRDLY_NAMED_FILE"
1723+
'
1724+
17201725
test_expect_success !MINGW '--show-origin escape special file name characters' '
17211726
cat >expect <<-\EOF &&
17221727
file:"file\" (dq) and spaces.conf" user.custom=true
17231728
EOF
1724-
git config --file "$CUSTOM_CONFIG_FILE" --show-origin --list >output &&
1729+
git config --file "$WEIRDLY_NAMED_FILE" --show-origin --list >output &&
17251730
test_cmp expect output
17261731
'
17271732

@@ -1747,7 +1752,7 @@ test_expect_success '--show-origin stdin with file include' '
17471752
test_cmp expect output
17481753
'
17491754

1750-
test_expect_success !MINGW '--show-origin blob' '
1755+
test_expect_success '--show-origin blob' '
17511756
blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
17521757
cat >expect <<-EOF &&
17531758
blob:$blob user.custom=true
@@ -1756,9 +1761,9 @@ test_expect_success !MINGW '--show-origin blob' '
17561761
test_cmp expect output
17571762
'
17581763

1759-
test_expect_success !MINGW '--show-origin blob ref' '
1764+
test_expect_success '--show-origin blob ref' '
17601765
cat >expect <<-\EOF &&
1761-
blob:"master:file\" (dq) and spaces.conf" user.custom=true
1766+
blob:master:custom.conf user.custom=true
17621767
EOF
17631768
git add "$CUSTOM_CONFIG_FILE" &&
17641769
git commit -m "new config file" &&

0 commit comments

Comments
 (0)