]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ab/test-quoting-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 27 Jul 2022 20:00:31 +0000 (13:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Jul 2022 20:00:31 +0000 (13:00 -0700)
Fixes for tests when the source directory has unusual characters in
its path, e.g. whitespaces, double-quotes, etc.
source: <cover-v2-0.3-00000000000-20220630T101646Z-avarab@gmail.com>

* 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

t/t1300-config.sh
t/t3700-add.sh
t/t3903-stash.sh
t/t7609-mergetool--lib.sh
t/test-lib.sh

index d3d9adbb3dba675ea6b22d7006faa4884315f4ae..c6661e61af55219b73a20262aad5106bf203c3e2 100755 (executable)
@@ -2083,12 +2083,13 @@ test_expect_success '--show-scope with --show-origin' '
 '
 
 test_expect_success 'override global and system config' '
-       test_when_finished rm -f "$HOME"/.config/git &&
-
+       test_when_finished rm -f \"\$HOME\"/.gitconfig &&
        cat >"$HOME"/.gitconfig <<-EOF &&
        [home]
                config = true
        EOF
+
+       test_when_finished rm -rf \"\$HOME\"/.config/git &&
        mkdir -p "$HOME"/.config/git &&
        cat >"$HOME"/.config/git/config <<-EOF &&
        [xdg]
index 8979c8a5f03e4ca14c2eef5443cd2064ccb79557..8689b48589c0d515b9d15b86e4e00807fd26f566 100755 (executable)
@@ -8,7 +8,7 @@ test_description='Test of git add, including the -- option.'
 TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
-. $TEST_DIRECTORY/lib-unique-files.sh
+. "$TEST_DIRECTORY"/lib-unique-files.sh
 
 # Test the file mode "$1" of the file "$2" in the index.
 test_mode_in_index () {
index 20e94881964d5535e86d0332114d6fcb3495e0ba..2a4c3fd61c000d2278d362a34ae069760709172d 100755 (executable)
@@ -9,7 +9,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
-. $TEST_DIRECTORY/lib-unique-files.sh
+. "$TEST_DIRECTORY"/lib-unique-files.sh
 
 test_expect_success 'usage on cmd and subcommand invalid option' '
        test_expect_code 129 git stash --invalid-option 2>usage &&
index d848fe6442b104b71ee7ac96cd21de7c9db0d316..330d6d603d77236788ee932cdcc288731a7aa388 100755 (executable)
@@ -7,7 +7,7 @@ Testing basic merge tools options'
 . ./test-lib.sh
 
 test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
-       . $GIT_BUILD_DIR/mergetools/vimdiff &&
+       . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
        run_unit_tests
 '
 
index 55857af601b43f532a7de3fe8affdb42e2c0317f..8cabb4d10f9aaf9e500cd27b9be91fe9719d62a9 100644 (file)
@@ -57,14 +57,14 @@ fi
 #
 #      prepend_var VAR : VALUE
 prepend_var () {
-       eval "$1=$3\${$1:+${3:+$2}\$$1}"
+       eval "$1=\"$3\${$1:+${3:+$2}\$$1}\""
 }
 
 # If [AL]SAN is in effect we want to abort so that we notice
 # problems. The GIT_SAN_OPTIONS variable can be used to set common
 # defaults shared between [AL]SAN_OPTIONS.
 prepend_var GIT_SAN_OPTIONS : abort_on_error=1
-prepend_var GIT_SAN_OPTIONS : strip_path_prefix=\"$GIT_BUILD_DIR/\"
+prepend_var GIT_SAN_OPTIONS : strip_path_prefix="$GIT_BUILD_DIR/"
 
 # If we were built with ASAN, it may complain about leaks
 # of program-lifetime variables. Disable it by default to lower