From: Junio C Hamano Date: Sun, 7 Apr 2013 21:31:08 +0000 (-0700) Subject: Merge branch 'jk/set-upstream-error-cases' X-Git-Tag: v1.8.3-rc0~98 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/88dccb6c989735e2faa24fa78d441a7a1c998b36?ds=inline;hp=-c Merge branch 'jk/set-upstream-error-cases' The handing by "git branch --set-upstream-to" against various forms of errorneous inputs were suboptimal. * jk/set-upstream-error-cases: branch: give advice when tracking start-point is missing branch: mention start_name in set-upstream error messages branch: improve error message for missing --set-upstream-to ref branch: factor out "upstream is not a branch" error messages t3200: test --set-upstream-to with bogus refs --- 88dccb6c989735e2faa24fa78d441a7a1c998b36 diff --combined t/t3200-branch.sh index 8311c7da44,09f65f8358..d969f0ecd8 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@@ -75,7 -75,7 +75,7 @@@ test_expect_success 'git branch l shoul 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' ' @@@ -409,6 -409,18 +409,18 @@@ test_expect_success '--set-upstream-to 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 &&