aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-04-02 15:02:53 -0400
committerJunio C Hamano <gitster@pobox.com>2013-04-02 16:14:06 -0700
commit8a3e5ecdaa9fc45d7af58eb95bba0f39ca625a8d (patch)
tree1624bbeeb1f2812974ecc6348a2e4cacd31a10d2
parent961c5129d53554d4d71003899fab8dda846d7c2a (diff)
downloadgit-8a3e5ecdaa9fc45d7af58eb95bba0f39ca625a8d.tar.gz
git-8a3e5ecdaa9fc45d7af58eb95bba0f39ca625a8d.tar.xz
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>
-rwxr-xr-xt/t3200-branch.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index b08c9f229..09f65f835 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -409,6 +409,18 @@ test_expect_success '--set-upstream-to fails on detached HEAD' '
git checkout -
'
+test_expect_success '--set-upstream-to fails on a missing dst branch' '
+ test_must_fail git branch --set-upstream-to master does-not-exist
+'
+
+test_expect_success '--set-upstream-to fails on a missing src branch' '
+ test_must_fail git branch --set-upstream-to does-not-exist master
+'
+
+test_expect_success '--set-upstream-to fails on a non-ref' '
+ test_must_fail git branch --set-upstream-to HEAD^{}
+'
+
test_expect_success 'use --set-upstream-to modify HEAD' '
test_config branch.master.remote foo &&
test_config branch.master.merge foo &&