Skip to content

Commit 1d7106b

Browse files
committed
Merge branch 'ab/test-quoting-fix' into maint
Fixes for tests when the source directory has unusual characters in its path, e.g. whitespaces, double-quotes, etc. source: <[email protected]> * ab/test-quoting-fix: config tests: fix harmless but broken "rm -r" cleanup test-lib.sh: fix prepend_var() quoting issue tests: add missing double quotes to included library paths
2 parents 54ec7b8 + eb1cd60 commit 1d7106b

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

t/t1300-config.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,12 +2083,13 @@ test_expect_success '--show-scope with --show-origin' '
20832083
'
20842084

20852085
test_expect_success 'override global and system config' '
2086-
test_when_finished rm -f "$HOME"/.config/git &&
2087-
2086+
test_when_finished rm -f \"\$HOME\"/.gitconfig &&
20882087
cat >"$HOME"/.gitconfig <<-EOF &&
20892088
[home]
20902089
config = true
20912090
EOF
2091+
2092+
test_when_finished rm -rf \"\$HOME\"/.config/git &&
20922093
mkdir -p "$HOME"/.config/git &&
20932094
cat >"$HOME"/.config/git/config <<-EOF &&
20942095
[xdg]

t/t3700-add.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test_description='Test of git add, including the -- option.'
88
TEST_PASSES_SANITIZE_LEAK=true
99
. ./test-lib.sh
1010

11-
. $TEST_DIRECTORY/lib-unique-files.sh
11+
. "$TEST_DIRECTORY"/lib-unique-files.sh
1212

1313
# Test the file mode "$1" of the file "$2" in the index.
1414
test_mode_in_index () {

t/t3903-stash.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
99
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1010

1111
. ./test-lib.sh
12-
. $TEST_DIRECTORY/lib-unique-files.sh
12+
. "$TEST_DIRECTORY"/lib-unique-files.sh
1313

1414
test_expect_success 'usage on cmd and subcommand invalid option' '
1515
test_expect_code 129 git stash --invalid-option 2>usage &&

t/t7609-mergetool--lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Testing basic merge tools options'
77
. ./test-lib.sh
88

99
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
10-
. $GIT_BUILD_DIR/mergetools/vimdiff &&
10+
. "$GIT_BUILD_DIR"/mergetools/vimdiff &&
1111
run_unit_tests
1212
'
1313

t/test-lib.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ fi
5757
#
5858
# prepend_var VAR : VALUE
5959
prepend_var () {
60-
eval "$1=$3\${$1:+${3:+$2}\$$1}"
60+
eval "$1=\"$3\${$1:+${3:+$2}\$$1}\""
6161
}
6262

6363
# If [AL]SAN is in effect we want to abort so that we notice
6464
# problems. The GIT_SAN_OPTIONS variable can be used to set common
6565
# defaults shared between [AL]SAN_OPTIONS.
6666
prepend_var GIT_SAN_OPTIONS : abort_on_error=1
67-
prepend_var GIT_SAN_OPTIONS : strip_path_prefix=\"$GIT_BUILD_DIR/\"
67+
prepend_var GIT_SAN_OPTIONS : strip_path_prefix="$GIT_BUILD_DIR/"
6868

6969
# If we were built with ASAN, it may complain about leaks
7070
# of program-lifetime variables. Disable it by default to lower

0 commit comments

Comments
 (0)