[PATCH 11/12] t0610: fix non-portable variable assignment
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Apr 4, 2024, 13:25 UTC
- Message-ID
- <c2c2747ff57f68ccad8b509af037e1fc4a524fa1.1712235356.git.ps@pks.im>
- In-Reply-To
- <cover.1712235356.git.ps@pks.im>
In `test_expect_perms()` we assign the output of a command to a variable declared via `local`. To assert that the command is actually successful we also chain it with `&&`. This construct is seemingly not portable and may fail with "local: 1: bad variable name".
Split up the variable declaration and assignment to fix this.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- t/t0610-reftable-basics.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh index aa9282007c..3b1aa99e7c 100755 --- a/t/t0610-reftable-basics.sh +++ b/t/t0610-reftable-basics.sh @@ -80,8 +80,9 @@ test_expect_success 'init: reinitializing reftable with files backend fails' ' test_expect_perms () { local perms="$1" local file="$2" - local actual=$(ls -l "$file") && + local actual + actual=$(ls -l "$file") && case "$actual" in $perms*) : happy
-- 2.44.GIT