branch: give better message when no names specified for rename

Signed-off-by: Jonathon Mah <me@JonathonMah.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathon Mah committed Mar 30, 2013 at 18:27 UTC d1520c4b1a6105356c7a2def6b90239057270598
2 files changed +4 -2
builtin/branch.c
+3 -1
@@ -880,7 +880,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
880 if (edit_branch_description(branch_name))
881 return 1;
882 } else if (rename) {
883 - if (argc == 1)
883 + if (!argc)
884 + die(_("branch name required"));
885 + else if (argc == 1)
886 rename_branch(head, argv[0], rename > 1);
887 else if (argc == 2)
888 rename_branch(argv[0], argv[1], rename > 1);
t/t3200-branch.sh
+1 -1
@@ -78,7 +78,7 @@ test_expect_success \
78 test_expect_success \
79 'git branch -m dumps usage' \
80 'test_expect_code 128 git branch -m 2>err &&
81 - test_i18ngrep "too many branches for a rename operation" err'
81 + test_i18ngrep "branch name required" err'
82
83 test_expect_success \
84 'git branch -m m m/m should work' \