Skip to content

Commit 45091f8

Browse files
committed
t2205: drop non-portable local outside a function
The "pre-add" tests assign `local parent_dir="$(pwd)"` inside a `(...)` subshell. bash tolerates `local` there because the test body is eval'd within test-lib's helper function, but BusyBox' `ash` rejects it with "local: not in a function" and aborts the test. The subshell already scopes the variable, so the `local` keyword is redundant; drop it. Assisted-by: Opus 4.8 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 9b82141 commit 45091f8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

t/t2205-add-worktree-config.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test_expect_success '1a: setup--config worktree' '
7272
test_expect_success '1b: pre-add all' '
7373
(
7474
cd test1 &&
75-
local parent_dir="$(pwd)" &&
75+
parent_dir="$(pwd)" &&
7676
git -C repo ls-files -o --exclude-standard "$parent_dir" >actual-all-unsorted &&
7777
sort actual-all-unsorted >actual-all &&
7878
sort expect-all-unsorted >expect-all &&
@@ -83,7 +83,7 @@ test_expect_success '1b: pre-add all' '
8383
test_expect_success '1c: pre-add dir all' '
8484
(
8585
cd test1 &&
86-
local parent_dir="$(pwd)" &&
86+
parent_dir="$(pwd)" &&
8787
git -C repo ls-files -o --directory --exclude-standard "$parent_dir" >actual-all-dir-unsorted &&
8888
sort actual-all-dir-unsorted >actual-all &&
8989
sort expect-all-dir-unsorted >expect-all &&
@@ -94,7 +94,7 @@ test_expect_success '1c: pre-add dir all' '
9494
test_expect_success '1d: post-add tracked' '
9595
(
9696
cd test1 &&
97-
local parent_dir="$(pwd)" &&
97+
parent_dir="$(pwd)" &&
9898
(
9999
cd repo &&
100100
git add file-tracked &&
@@ -112,7 +112,7 @@ test_expect_success '1d: post-add tracked' '
112112
test_expect_success '1e: post-add untracked' '
113113
(
114114
cd test1 &&
115-
local parent_dir="$(pwd)" &&
115+
parent_dir="$(pwd)" &&
116116
git -C repo ls-files -o --exclude-standard "$parent_dir" >actual-untracked-unsorted &&
117117
sort actual-untracked-unsorted >actual-untracked &&
118118
sort expect-untracked-unsorted >expect-untracked &&

0 commit comments

Comments
 (0)