]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3200-branch.sh
t3200: Minor fix when preparing for tracking failure
[thirdparty/git.git] / t / t3200-branch.sh
index b08c9f22951bf447cc769c043a165d087fa5e38d..8f6ab8e16054bb629768c70c44045f32f6b7722e 100755 (executable)
@@ -75,7 +75,7 @@ test_expect_success 'git branch l should work after branch l/m has been deleted'
 
 test_expect_success 'git branch -m dumps usage' '
        test_expect_code 128 git branch -m 2>err &&
-       test_i18ngrep "too many branches for a rename operation" err
+       test_i18ngrep "branch name required" err
 '
 
 test_expect_success 'git branch -m m m/m should work' '
@@ -317,13 +317,14 @@ test_expect_success 'test tracking setup (non-wildcard, matching)' '
        test $(git config branch.my4.merge) = refs/heads/master
 '
 
-test_expect_success 'test tracking setup (non-wildcard, not matching)' '
+test_expect_success 'tracking setup fails on non-matching refspec' '
        git config remote.local.url . &&
-       git config remote.local.fetch refs/heads/s:refs/remotes/local/s &&
+       git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
        (git show-ref -q refs/remotes/local/master || git fetch local) &&
-       git branch --track my5 local/master &&
-       ! test "$(git config branch.my5.remote)" = local &&
-       ! test "$(git config branch.my5.merge)" = refs/heads/master
+       git config remote.local.fetch refs/heads/s:refs/remotes/local/s &&
+       test_must_fail git branch --track my5 local/master &&
+       test_must_fail git config branch.my5.remote &&
+       test_must_fail git config branch.my5.merge
 '
 
 test_expect_success 'test tracking setup via config' '
@@ -409,6 +410,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 &&