Skip to content

Commit 4eaadc8

Browse files
phil-blaingitster
authored andcommitted
t2405: use git -C and test_commit -C instead of subshells
The subshells used in the setup phase of this test are unnecessary. Remove them by using 'git -C' and 'test_commit -C'. Signed-off-by: Philippe Blain <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 773c60a commit 4eaadc8

File tree

1 file changed

+9
-25
lines changed

1 file changed

+9
-25
lines changed

t/t2405-worktree-submodule.sh

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,16 @@ test_description='Combination of submodules and multiple worktrees'
66

77
base_path=$(pwd -P)
88

9-
test_expect_success 'setup: make origin' '
10-
mkdir -p origin/sub &&
11-
(
12-
cd origin/sub && git init &&
13-
echo file1 >file1 &&
14-
git add file1 &&
15-
git commit -m file1
16-
) &&
17-
mkdir -p origin/main &&
18-
(
19-
cd origin/main && git init &&
20-
git submodule add ../sub &&
21-
git commit -m "add sub"
22-
) &&
23-
(
24-
cd origin/sub &&
25-
echo file1updated >file1 &&
26-
git add file1 &&
27-
git commit -m "file1 updated"
28-
) &&
9+
test_expect_success 'setup: create origin repos' '
10+
git init origin/sub &&
11+
test_commit -C origin/sub file1 &&
12+
git init origin/main &&
13+
git -C origin/main submodule add ../sub &&
14+
git -C origin/main commit -m "add sub" &&
15+
test_commit -C origin/sub "file1 updated" file1 file1updated file1updated &&
2916
git -C origin/main/sub pull &&
30-
(
31-
cd origin/main &&
32-
git add sub &&
33-
git commit -m "sub updated"
34-
)
17+
git -C origin/main add sub &&
18+
git -C origin/main commit -m "sub updated"
3519
'
3620

3721
test_expect_success 'setup: clone' '

0 commit comments

Comments
 (0)