Skip to content

Commit 95052d1

Browse files
modocachegitster
authored andcommitted
t3200-branch: test setting branch as own upstream
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 <[email protected]> Helped-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5f95c9f commit 95052d1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

t/t3200-branch.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,16 @@ EOF
507507
test_cmp expected actual
508508
'
509509

510+
test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '
511+
git branch --set-upstream-to refs/heads/my13 my13 2>actual &&
512+
cat >expected <<-\EOF &&
513+
warning: Not setting branch my13 as its own upstream.
514+
EOF
515+
test_expect_code 1 git config branch.my13.remote &&
516+
test_expect_code 1 git config branch.my13.merge &&
517+
test_i18ncmp expected actual
518+
'
519+
510520
# Keep this test last, as it changes the current branch
511521
cat >expect <<EOF
512522
$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master

0 commit comments

Comments
 (0)