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 &&
21 git commit -m "Initial junk"
24 git commit -m "Initial superproject"
28 test_expect_success push '
31 git push ../pub.git master
35 test_expect_success 'push if submodule has no remote' '
40 git commit -m "Second junk"
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' '
53 git clone --bare bage ../../submodule.git &&
55 git remote add origin ../../../submodule.git &&
59 git commit -m "Third junk"
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' '
72 git push origin master
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' '
85 git commit -m "Fourth junk"
91 git commit -m "Fourth commit for gar/bage" &&
92 git checkout branch2 &&
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' '
114 git commit -m "initial"
117 git commit -m "added submodule" &&
118 git push --recurse-submodule=check origin master
122 test_expect_success 'push unpushed submodules when not needed' '
127 git checkout master &&
130 git commit -m "Fifth junk" &&
132 git rev-parse origin/master >../../../expected
134 git checkout master &&
136 git commit -m "Fifth commit for gar/bage" &&
137 git push --recurse-submodules=on-demand ../pub.git master
141 git rev-parse master >../actual
143 test_cmp expected actual
146 test_expect_success 'push unpushed submodules when not needed 2' '
149 git rev-parse master >../expected
157 git commit -m "Sixth junk"
161 git commit -m "Second junk for work" &&
162 git push --recurse-submodules=on-demand ../pub.git master
166 git rev-parse master >../actual
168 test_cmp expected actual
171 test_expect_success 'push unpushed submodules recursively' '
176 git checkout master &&
179 git commit -m "Seventh junk" &&
180 git rev-parse master >../../../expected
182 git checkout master &&
184 git commit -m "Seventh commit for gar/bage" &&
185 git push --recurse-submodules=on-demand ../pub.git master
189 git rev-parse master >../actual
191 test_cmp expected actual
194 test_expect_success 'push unpushable submodule recursively fails' '
199 git rev-parse origin/master >../../../expected &&
200 git checkout master~0 &&
203 git commit -m "Eighth junk"
206 git commit -m "Eighth commit for gar/bage" &&
207 test_must_fail git push --recurse-submodules=on-demand ../pub.git master
211 git rev-parse master >../actual
213 test_cmp expected actual