perf: export some important test-lib variables
[git/gitweb.git] / t / t5531-deep-submodule-push.sh
blob30bec4b5f9f286cd97c57b70e3635c6c5c8cf85a
1 #!/bin/sh
3 test_description='unpack-objects'
5 . ./test-lib.sh
7 test_expect_success setup '
8 mkdir pub.git &&
9 GIT_DIR=pub.git git init --bare &&
10 GIT_DIR=pub.git git config receive.fsckobjects true &&
11 mkdir work &&
13 cd work &&
14 git init &&
15 mkdir -p gar/bage &&
17 cd gar/bage &&
18 git init &&
19 >junk &&
20 git add junk &&
21 git commit -m "Initial junk"
22 ) &&
23 git add gar/bage &&
24 git commit -m "Initial superproject"
28 test_expect_success push '
30 cd work &&
31 git push ../pub.git master
35 test_expect_success 'push if submodule has no remote' '
37 cd work/gar/bage &&
38 >junk2 &&
39 git add junk2 &&
40 git commit -m "Second junk"
41 ) &&
43 cd work &&
44 git add gar/bage &&
45 git commit -m "Second commit for gar/bage" &&
46 git push --recurse-submodules=check ../pub.git master
50 test_expect_success 'push fails if submodule commit not on remote' '
52 cd work/gar &&
53 git clone --bare bage ../../submodule.git &&
54 cd bage &&
55 git remote add origin ../../../submodule.git &&
56 git fetch &&
57 >junk3 &&
58 git add junk3 &&
59 git commit -m "Third junk"
60 ) &&
62 cd work &&
63 git add gar/bage &&
64 git commit -m "Third commit for gar/bage" &&
65 test_must_fail git push --recurse-submodules=check ../pub.git master
69 test_expect_success 'push succeeds after commit was pushed to remote' '
71 cd work/gar/bage &&
72 git push origin master
73 ) &&
75 cd work &&
76 git push --recurse-submodules=check ../pub.git master
80 test_expect_success 'push fails when commit on multiple branches if one branch has no remote' '
82 cd work/gar/bage &&
83 >junk4 &&
84 git add junk4 &&
85 git commit -m "Fourth junk"
86 ) &&
88 cd work &&
89 git branch branch2 &&
90 git add gar/bage &&
91 git commit -m "Fourth commit for gar/bage" &&
92 git checkout branch2 &&
94 cd gar/bage &&
95 git checkout HEAD~1
96 ) &&
97 >junk1 &&
98 git add junk1 &&
99 git commit -m "First junk" &&
100 test_must_fail git push --recurse-submodules=check ../pub.git
104 test_expect_success 'push succeeds if submodule has no remote and is on the first superproject commit' '
105 git init --bare a
106 git clone a a1 &&
108 cd a1 &&
109 git init b
111 cd b &&
112 >junk &&
113 git add junk &&
114 git commit -m "initial"
115 ) &&
116 git add b &&
117 git commit -m "added submodule" &&
118 git push --recurse-submodule=check origin master
122 test_done