Skip to content

Commit

Permalink
branch: give better message when no names specified for rename
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathon Mah <me@JonathonMah.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jonathon Mah authored and Junio C Hamano committed Apr 1, 2013
1 parent 631bc94 commit d1520c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion builtin/branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion t/t3200-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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' \
Expand Down

0 comments on commit d1520c4

Please sign in to comment.