diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-04-05 17:09:00 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-05 22:50:10 -0700 |
commit | 7f9f230b7fcc1bfeb352216930f704075bca713d (patch) | |
tree | ab2ac4c0b265bfb8839954886db1640a85177839 | |
parent | 341aad8d41ca8321d826e1ce012e4faf1a8be2a4 (diff) | |
download | git-7f9f230b7fcc1bfeb352216930f704075bca713d.tar.gz |
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>
-rwxr-xr-x | t/t4011-diff-symlink.sh | 4 | ||||
-rw-r--r-- | t/test-lib-functions.sh | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh index d7a5f7ae78..bc8ba88719 100755 --- a/t/t4011-diff-symlink.sh +++ b/t/t4011-diff-symlink.sh @@ -13,13 +13,13 @@ TEST_PASSES_SANITIZE_LEAK=true # Print the short OID of a symlink with the given name. symlink_oid () { - local oid=$(printf "%s" "$1" | git hash-object --stdin) && + local oid="$(printf "%s" "$1" | git hash-object --stdin)" && git rev-parse --short "$oid" } # Print the short OID of the given file. short_oid () { - local oid=$(git hash-object "$1") && + local oid="$(git hash-object "$1")" && git rev-parse --short "$oid" } diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index fc60708471..4cc7d74f11 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1840,7 +1840,7 @@ test_subcommand () { shift fi - local expr=$(printf '"%s",' "$@") + local expr="$(printf '"%s",' "$@")" expr="${expr%,}" if test -n "$negate" |