3 test_description
='unpack-objects'
7 test_expect_success setup
'
9 GIT_DIR=pub.git git init --bare &&
10 GIT_DIR=pub.git git config receive.fsckobjects true &&
15 git config push.default matching &&
20 git config push.default matching &&
23 git commit -m "Initial junk"
26 git commit -m "Initial superproject"
30 test_expect_success push
'
33 git push ../pub.git master
37 test_expect_success
'push if submodule has no remote' '
42 git commit -m "Second junk"
47 git commit -m "Second commit for gar/bage" &&
48 git push --recurse-submodules=check ../pub.git master
52 test_expect_success
'push fails if submodule commit not on remote' '
55 git clone --bare bage ../../submodule.git &&
57 git remote add origin ../../../submodule.git &&
61 git commit -m "Third junk"
66 git commit -m "Third commit for gar/bage" &&
67 test_must_fail git push --recurse-submodules=check ../pub.git master
71 test_expect_success
'push succeeds after commit was pushed to remote' '
74 git push origin master
78 git push --recurse-submodules=check ../pub.git master
82 test_expect_success
'push fails when commit on multiple branches if one branch has no remote' '
87 git commit -m "Fourth junk"
93 git commit -m "Fourth commit for gar/bage" &&
94 git checkout branch2 &&
101 git commit -m "First junk" &&
102 test_must_fail git push --recurse-submodules=check ../pub.git
106 test_expect_success
'push succeeds if submodule has no remote and is on the first superproject commit' '
116 git commit -m "initial"
119 git commit -m "added submodule" &&
120 git push --recurse-submodule=check origin master
124 test_expect_success
'push unpushed submodules when not needed' '
129 git checkout master &&
132 git commit -m "Fifth junk" &&
134 git rev-parse origin/master >../../../expected
136 git checkout master &&
138 git commit -m "Fifth commit for gar/bage" &&
139 git push --recurse-submodules=on-demand ../pub.git master
143 git rev-parse master >../actual
145 test_cmp expected actual
148 test_expect_success
'push unpushed submodules when not needed 2' '
151 git rev-parse master >../expected
159 git commit -m "Sixth junk"
163 git commit -m "Second junk for work" &&
164 git push --recurse-submodules=on-demand ../pub.git master
168 git rev-parse master >../actual
170 test_cmp expected actual
173 test_expect_success
'push unpushed submodules recursively' '
178 git checkout master &&
181 git commit -m "Seventh junk" &&
182 git rev-parse master >../../../expected
184 git checkout master &&
186 git commit -m "Seventh commit for gar/bage" &&
187 git push --recurse-submodules=on-demand ../pub.git master
191 git rev-parse master >../actual
193 test_cmp expected actual
196 test_expect_success
'push unpushable submodule recursively fails' '
201 git rev-parse origin/master >../../../expected &&
202 git checkout master~0 &&
205 git commit -m "Eighth junk"
208 git commit -m "Eighth commit for gar/bage" &&
209 test_must_fail git push --recurse-submodules=on-demand ../pub.git master
213 git rev-parse master >../actual
215 test_cmp expected actual