branch: give better message when no names specified for rename
authorJonathon Mah <me@JonathonMah.com>
Sun, 31 Mar 2013 01:27:44 +0000 (18:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Apr 2013 02:58:02 +0000 (19:58 -0700)
Signed-off-by: Jonathon Mah <me@JonathonMah.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c
t/t3200-branch.sh
index 00d17d25d1866323f9e1dffcb334a573f5de5221..580107fd78e0415c0c95814b95056f8ad508bea1 100644 (file)
@@ -880,7 +880,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 12f1e4a63c33b2f394ea37db71e1cd4467cee8f5..a64c9d2dd3732170918e7891854c0400d7f88b9e 100755 (executable)
@@ -78,7 +78,7 @@ test_expect_success \
 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' \