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 <modocache@gmail.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brian Gesiak committed
Mar 5, 2014 at 16:31 UTC
95052d1f2db7103b4ff8d44591fc614419ae6eb2
1 file changed
+10
t/t3200-branch.sh
+10
@@ -507,6 +507,16 @@ EOF
507
test_cmp expected actual
508
'
509
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
+
520
# Keep this test last, as it changes the current branch
521
cat >expect <<EOF
522
$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master