t: local VAR="VAL" (quote command substitution)

Future-proof test scripts that do local VAR=VAL without quoting VAL (which is OK in POSIX but broken in some shells) that is a $(command substitution). Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Apr 5, 2024 at 17:09 UTC 7f9f230b7fcc1bfeb352216930f704075bca713d
2 files changed +3 -3
t/t4011-diff-symlink.sh
+2 -2
@@ -13,13 +13,13 @@ TEST_PASSES_SANITIZE_LEAK=true
13
14 # Print the short OID of a symlink with the given name.
15 symlink_oid () {
16 - local oid=$(printf "%s" "$1" | git hash-object --stdin) &&
16 + local oid="$(printf "%s" "$1" | git hash-object --stdin)" &&
17 git rev-parse --short "$oid"
18 }
19
20 # Print the short OID of the given file.
21 short_oid () {
22 - local oid=$(git hash-object "$1") &&
22 + local oid="$(git hash-object "$1")" &&
23 git rev-parse --short "$oid"
24 }
25
t/test-lib-functions.sh
+1 -1
@@ -1840,7 +1840,7 @@ test_subcommand () {
1840 shift
1841 fi
1842
1843 - local expr=$(printf '"%s",' "$@")
1843 + local expr="$(printf '"%s",' "$@")"
1844 expr="${expr%,}"
1845
1846 if test -n "$negate"