@matheusbsbs / matheus-bagliano / commits / 09fba7a59d
Fork 0

t5516: test update of local refs on push

The first test (updating local refs) should succeed without the prior commit, but the second one (not updating on error) used to fail before the prior commit was written. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Jeff King committed Oct 18, 2007 at 02:17 UTC 09fba7a59d38d1cafaf33eadaf1d409c4113b30c
1 file changed +28
t/t5516-fetch-push.sh
+28
@@ -254,4 +254,32 @@ test_expect_success 'push with dry-run' '
254 check_push_result $old_commit heads/master
255 '
256
257 +test_expect_success 'push updates local refs' '
258 +
259 + rm -rf parent child &&
260 + mkdir parent && cd parent && git init &&
261 + echo one >foo && git add foo && git commit -m one &&
262 + cd .. &&
263 + git clone parent child && cd child &&
264 + echo two >foo && git commit -a -m two &&
265 + git push &&
266 + test $(git rev-parse master) = $(git rev-parse remotes/origin/master)
267 +
268 +'
269 +
270 +test_expect_success 'push does not update local refs on failure' '
271 +
272 + rm -rf parent child &&
273 + mkdir parent && cd parent && git init &&
274 + echo one >foo && git add foo && git commit -m one &&
275 + echo exit 1 >.git/hooks/pre-receive &&
276 + chmod +x .git/hooks/pre-receive &&
277 + cd .. &&
278 + git clone parent child && cd child &&
279 + echo two >foo && git commit -a -m two || exit 1
280 + git push && exit 1
281 + test $(git rev-parse master) != $(git rev-parse remotes/origin/master)
282 +
283 +'
284 +
285 test_done