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 &&
19 git config push.default matching &&
22 git commit -m "Initial junk"
25 git commit -m "Initial superproject"
29 test_expect_success push
'
32 git push ../pub.git master
36 test_expect_success
'push if submodule has no remote' '
41 git commit -m "Second junk"
46 git commit -m "Second commit for gar/bage" &&
47 git push --recurse-submodules=check ../pub.git master
51 test_expect_success
'push fails if submodule commit not on remote' '
54 git clone --bare bage ../../submodule.git &&
56 git remote add origin ../../../submodule.git &&
60 git commit -m "Third junk"
65 git commit -m "Third commit for gar/bage" &&
66 test_must_fail git push --recurse-submodules=check ../pub.git master
70 test_expect_success
'push succeeds after commit was pushed to remote' '
73 git push origin master
77 git push --recurse-submodules=check ../pub.git master
81 test_expect_success
'push fails when commit on multiple branches if one branch has no remote' '
86 git commit -m "Fourth junk"
92 git commit -m "Fourth commit for gar/bage" &&
93 git checkout branch2 &&
100 git commit -m "First junk" &&
101 test_must_fail git push --recurse-submodules=check ../pub.git
105 test_expect_success
'push succeeds if submodule has no remote and is on the first superproject commit' '
115 git commit -m "initial"
118 git commit -m "added submodule" &&
119 git push --recurse-submodule=check origin master
123 test_expect_success
'push unpushed submodules when not needed' '
128 git checkout master &&
131 git commit -m "Fifth junk" &&
133 git rev-parse origin/master >../../../expected
135 git checkout master &&
137 git commit -m "Fifth commit for gar/bage" &&
138 git push --recurse-submodules=on-demand ../pub.git master
142 git rev-parse master >../actual
144 test_cmp expected actual
147 test_expect_success
'push unpushed submodules when not needed 2' '
150 git rev-parse master >../expected
158 git commit -m "Sixth junk"
162 git commit -m "Second junk for work" &&
163 git push --recurse-submodules=on-demand ../pub.git master
167 git rev-parse master >../actual
169 test_cmp expected actual
172 test_expect_success
'push unpushed submodules recursively' '
177 git checkout master &&
180 git commit -m "Seventh junk" &&
181 git rev-parse master >../../../expected
183 git checkout master &&
185 git commit -m "Seventh commit for gar/bage" &&
186 git push --recurse-submodules=on-demand ../pub.git master
190 git rev-parse master >../actual
192 test_cmp expected actual
195 test_expect_success
'push unpushable submodule recursively fails' '
200 git rev-parse origin/master >../../../expected &&
201 git checkout master~0 &&
204 git commit -m "Eighth junk"
207 git commit -m "Eighth commit for gar/bage" &&
208 test_must_fail git push --recurse-submodules=on-demand ../pub.git master
212 git rev-parse master >../actual
214 test_cmp expected actual