@matheusbsbs / matheus-bagliano / commits / fe454b1315
Fork 0

t7400: split setup into multiple tests

The setup in t7400-submodule-basic does a number of different things to support different tests. Splitting it up makes the test a little easier to read and should provide an opportunity to move each piece of setup closer to the tests that require it. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed Apr 10, 2010 at 00:38 UTC fe454b13156e639adaae4526d04fd5b74eb8c84c
1 file changed +30 -28
t/t7400-submodule-basic.sh
+30 -28
@@ -11,40 +11,42 @@ subcommands of git submodule.
11
12 . ./test-lib.sh
13
14 -#
15 -# Test setup:
16 -# -create a repository in directory init
17 -# -add a couple of files
18 -# -add directory init to 'superproject', this creates a DIRLINK entry
19 -# -add a couple of regular files to enable testing of submodule filtering
20 -# -mv init subrepo
21 -# -add an entry to .gitmodules for submodule 'example'
22 -#
23 -test_expect_success 'Prepare submodule testing' '
24 - : > t &&
14 +test_expect_success 'setup - initial commit' '
15 + >t &&
16 git add t &&
17 git commit -m "initial commit" &&
27 - git branch initial HEAD &&
18 + git branch initial
19 +'
20 +
21 +test_expect_success 'setup - repository in init subdirectory' '
22 mkdir init &&
29 - cd init &&
30 - git init &&
31 - echo a >a &&
32 - git add a &&
33 - git commit -m "submodule commit 1" &&
34 - git tag -a -m "rev-1" rev-1 &&
35 - rev1=$(git rev-parse HEAD) &&
36 - if test -z "$rev1"
37 - then
38 - echo "[OOPS] submodule git rev-parse returned nothing"
39 - false
40 - fi &&
41 - cd .. &&
23 + (
24 + cd init &&
25 + git init &&
26 + echo a >a &&
27 + git add a &&
28 + git commit -m "submodule commit 1" &&
29 + git tag -a -m "rev-1" rev-1
30 + )
31 + rev1=$(cd init && git rev-parse HEAD) &&
32 + printf "rev1: %s\n" "$rev1" &&
33 + test -n "$rev1"
34 +'
35 +
36 +test_expect_success 'setup - commit with gitlink' '
37 echo a >a &&
38 echo z >z &&
39 git add a init z &&
45 - git commit -m "super commit 1" &&
46 - mv init .subrepo &&
47 - GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git
40 + git commit -m "super commit 1"
41 +'
42 +
43 +test_expect_success 'setup - hide init subdirectory' '
44 + mv init .subrepo
45 +'
46 +
47 +test_expect_success 'setup - add an example entry to .gitmodules' '
48 + GIT_CONFIG=.gitmodules \
49 + git config submodule.example.url git://example.com/init.git
50 '
51
52 test_expect_success 'Prepare submodule add testing' '