Merge branch 'jm/branch-rename-nothing-error'
authorJunio C Hamano <gitster@pobox.com>
Wed, 3 Apr 2013 16:34:40 +0000 (09:34 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Apr 2013 16:34:40 +0000 (09:34 -0700)
"git branch -m" without any argument noticed an error, but with an
incorrect error message.

* jm/branch-rename-nothing-error:
branch: give better message when no names specified for rename

builtin/branch.c
t/t3200-branch.sh
index e09ce51c2ee59ee4a9f44dbf43c97a2d31911b7b..3f0fbc082aef95b3d02a8b677116264eea892369 100644 (file)
@@ -904,7 +904,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                if (edit_branch_description(branch_name))
                        return 1;
        } else if (rename) {
-               if (argc == 1)
+               if (!argc)
+                       die(_("branch name required"));
+               else if (argc == 1)
                        rename_branch(head, argv[0], rename > 1);
                else if (argc == 2)
                        rename_branch(argv[0], argv[1], rename > 1);
index b08c9f22951bf447cc769c043a165d087fa5e38d..8311c7da440a5932107cd8e4787f236c29518861 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' '