Merge branch 'jk/set-upstream-error-cases'
authorJunio C Hamano <gitster@pobox.com>
Sun, 7 Apr 2013 21:31:08 +0000 (14:31 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 7 Apr 2013 21:31:08 +0000 (14:31 -0700)
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

1  2 
t/t3200-branch.sh
diff --combined t/t3200-branch.sh
index 8311c7da440a5932107cd8e4787f236c29518861,09f65f8358a70a85c4cf6fdfb4506f2edc19e6d1..d969f0ecd85a6907f219d141cad2c00c4b5a89f8
@@@ -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 &&