Skip to content

Commit

Permalink
t3200-branch: test setting branch as own upstream
Browse files Browse the repository at this point in the history
No test asserts that "git branch -u refs/heads/my-branch my-branch"
avoids leaving nonsense configuration and emits a warning.

Add a test that does so.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Brian Gesiak authored and Junio C Hamano committed Mar 6, 2014
1 parent 5f95c9f commit 95052d1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions t/t3200-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,16 @@ EOF
test_cmp expected actual
'

test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '
git branch --set-upstream-to refs/heads/my13 my13 2>actual &&
cat >expected <<-\EOF &&
warning: Not setting branch my13 as its own upstream.
EOF
test_expect_code 1 git config branch.my13.remote &&
test_expect_code 1 git config branch.my13.merge &&
test_i18ncmp expected actual
'

# Keep this test last, as it changes the current branch
cat >expect <<EOF
$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
Expand Down

0 comments on commit 95052d1

Please sign in to comment.