Skip to content

Commit d1520c4

Browse files
jmahgitster
authored andcommitted
branch: give better message when no names specified for rename
Signed-off-by: Jonathon Mah <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 631bc94 commit d1520c4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

builtin/branch.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
880880
if (edit_branch_description(branch_name))
881881
return 1;
882882
} else if (rename) {
883-
if (argc == 1)
883+
if (!argc)
884+
die(_("branch name required"));
885+
else if (argc == 1)
884886
rename_branch(head, argv[0], rename > 1);
885887
else if (argc == 2)
886888
rename_branch(argv[0], argv[1], rename > 1);

t/t3200-branch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ test_expect_success \
7878
test_expect_success \
7979
'git branch -m dumps usage' \
8080
'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'
8282

8383
test_expect_success \
8484
'git branch -m m m/m should work' \

0 commit comments

Comments
 (0)