t3200: test --set-upstream-to with bogus refs
These tests pass with the current code, but let's make sure we don't accidentally break the behavior in the future. Note that our tests expect failure when we try to set the upstream to or from a missing branch. Technically we are just munging config here, so we do not need the refs to exist. But seeing that they do exist is a good check that the user has not made a typo. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 2, 2013 at 15:02 UTC
8a3e5ecdaa9fc45d7af58eb95bba0f39ca625a8d
1 file changed
+12
t/t3200-branch.sh
+12
@@ -409,6 +409,18 @@ test_expect_success '--set-upstream-to fails on detached HEAD' '
409
git checkout -
410
'
411
412
+test_expect_success '--set-upstream-to fails on a missing dst branch' '
413
+ test_must_fail git branch --set-upstream-to master does-not-exist
414
+'
415
+
416
+test_expect_success '--set-upstream-to fails on a missing src branch' '
417
+ test_must_fail git branch --set-upstream-to does-not-exist master
418
+'
419
+
420
+test_expect_success '--set-upstream-to fails on a non-ref' '
421
+ test_must_fail git branch --set-upstream-to HEAD^{}
422
+'
423
+
424
test_expect_success 'use --set-upstream-to modify HEAD' '
425
test_config branch.master.remote foo &&
426
test_config branch.master.merge foo &&