Skip to content

Commit 43722c4

Browse files
pcloudsgitster
authored andcommitted
branch: give a more helpful message on redundant arguments
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 640d040 commit 43722c4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

builtin/branch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
859859
else if (argc == 1)
860860
branch_name = argv[0];
861861
else
862-
usage_with_options(builtin_branch_usage, options);
862+
die(_("cannot edit description of more than one branch"));
863863

864864
strbuf_addf(&branch_ref, "refs/heads/%s", branch_name);
865865
if (!ref_exists(branch_ref.buf)) {
@@ -881,7 +881,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
881881
else if (argc == 2)
882882
rename_branch(argv[0], argv[1], rename > 1);
883883
else
884-
usage_with_options(builtin_branch_usage, options);
884+
die(_("too many branches for a rename operation"));
885885
} else if (new_upstream) {
886886
struct branch *branch = branch_get(argv[0]);
887887

t/t3200-branch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ test_expect_success \
7373

7474
test_expect_success \
7575
'git branch -m dumps usage' \
76-
'test_expect_code 129 git branch -m 2>err &&
77-
test_i18ngrep "[Uu]sage: git branch" err'
76+
'test_expect_code 128 git branch -m 2>err &&
77+
test_i18ngrep "too many branches for a rename operation" err'
7878

7979
test_expect_success \
8080
'git branch -m m m/m should work' \

0 commit comments

Comments
 (0)