Skip to content

Commit 5819c2e

Browse files
stefanbellergitster
authored andcommitted
t5614: don't use subshells
Using a subshell for just one git command is both a waste in compute overhead (create a new process) as well as in line count. Suggested-by: Jeff King <[email protected]> Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 18a74a0 commit 5819c2e

File tree

1 file changed

+20
-50
lines changed

1 file changed

+20
-50
lines changed

t/t5614-clone-submodules.sh

Lines changed: 20 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -25,76 +25,46 @@ test_expect_success 'setup' '
2525
test_expect_success 'nonshallow clone implies nonshallow submodule' '
2626
test_when_finished "rm -rf super_clone" &&
2727
git clone --recurse-submodules "file://$pwd/." super_clone &&
28-
(
29-
cd super_clone &&
30-
git log --oneline >lines &&
31-
test_line_count = 3 lines
32-
) &&
33-
(
34-
cd super_clone/sub &&
35-
git log --oneline >lines &&
36-
test_line_count = 3 lines
37-
)
28+
git -C super_clone log --oneline >lines &&
29+
test_line_count = 3 lines &&
30+
git -C super_clone/sub log --oneline >lines &&
31+
test_line_count = 3 lines
3832
'
3933

4034
test_expect_success 'shallow clone with shallow submodule' '
4135
test_when_finished "rm -rf super_clone" &&
4236
git clone --recurse-submodules --depth 2 --shallow-submodules "file://$pwd/." super_clone &&
43-
(
44-
cd super_clone &&
45-
git log --oneline >lines &&
46-
test_line_count = 2 lines
47-
) &&
48-
(
49-
cd super_clone/sub &&
50-
git log --oneline >lines &&
51-
test_line_count = 1 lines
52-
)
37+
git -C super_clone log --oneline >lines &&
38+
test_line_count = 2 lines &&
39+
git -C super_clone/sub log --oneline >lines &&
40+
test_line_count = 1 lines
5341
'
5442

5543
test_expect_success 'shallow clone does not imply shallow submodule' '
5644
test_when_finished "rm -rf super_clone" &&
5745
git clone --recurse-submodules --depth 2 "file://$pwd/." super_clone &&
58-
(
59-
cd super_clone &&
60-
git log --oneline >lines &&
61-
test_line_count = 2 lines
62-
) &&
63-
(
64-
cd super_clone/sub &&
65-
git log --oneline >lines &&
66-
test_line_count = 3 lines
67-
)
46+
git -C super_clone log --oneline >lines &&
47+
test_line_count = 2 lines &&
48+
git -C super_clone/sub log --oneline >lines &&
49+
test_line_count = 3 lines
6850
'
6951

7052
test_expect_success 'shallow clone with non shallow submodule' '
7153
test_when_finished "rm -rf super_clone" &&
7254
git clone --recurse-submodules --depth 2 --no-shallow-submodules "file://$pwd/." super_clone &&
73-
(
74-
cd super_clone &&
75-
git log --oneline >lines &&
76-
test_line_count = 2 lines
77-
) &&
78-
(
79-
cd super_clone/sub &&
80-
git log --oneline >lines &&
81-
test_line_count = 3 lines
82-
)
55+
git -C super_clone log --oneline >lines &&
56+
test_line_count = 2 lines &&
57+
git -C super_clone/sub log --oneline >lines &&
58+
test_line_count = 3 lines
8359
'
8460

8561
test_expect_success 'non shallow clone with shallow submodule' '
8662
test_when_finished "rm -rf super_clone" &&
8763
git clone --recurse-submodules --no-local --shallow-submodules "file://$pwd/." super_clone &&
88-
(
89-
cd super_clone &&
90-
git log --oneline >lines &&
91-
test_line_count = 3 lines
92-
) &&
93-
(
94-
cd super_clone/sub &&
95-
git log --oneline >lines &&
96-
test_line_count = 1 lines
97-
)
64+
git -C super_clone log --oneline >lines &&
65+
test_line_count = 3 lines &&
66+
git -C super_clone/sub log --oneline >lines &&
67+
test_line_count = 1 lines
9868
'
9969

10070
test_done

0 commit comments

Comments
 (0)