Skip to content

Commit

Permalink
t3200: test --set-upstream-to with bogus refs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Apr 2, 2013
1 parent 961c512 commit 8a3e5ec
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions t/t3200-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 8a3e5ec

Please sign in to comment.