Skip to content

Commit 7f9f230

Browse files
committed
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 <[email protected]>
1 parent 341aad8 commit 7f9f230

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

t/t4011-diff-symlink.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ TEST_PASSES_SANITIZE_LEAK=true
1313

1414
# Print the short OID of a symlink with the given name.
1515
symlink_oid () {
16-
local oid=$(printf "%s" "$1" | git hash-object --stdin) &&
16+
local oid="$(printf "%s" "$1" | git hash-object --stdin)" &&
1717
git rev-parse --short "$oid"
1818
}
1919

2020
# Print the short OID of the given file.
2121
short_oid () {
22-
local oid=$(git hash-object "$1") &&
22+
local oid="$(git hash-object "$1")" &&
2323
git rev-parse --short "$oid"
2424
}
2525

t/test-lib-functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,7 @@ test_subcommand () {
18401840
shift
18411841
fi
18421842

1843-
local expr=$(printf '"%s",' "$@")
1843+
local expr="$(printf '"%s",' "$@")"
18441844
expr="${expr%,}"
18451845

18461846
if test -n "$negate"

0 commit comments

Comments
 (0)