Skip to content

Commit f777623

Browse files
Kaartic Sivaraamgitster
authored andcommitted
branch: change the error messages to be more meaningful
The error messages shown when the branch command is misused by supplying it wrong number of parameters wasn't meaningful. That's because it used the the phrase "too many branches" assuming all parameters to be "valid" branch names. It's not always the case as exemplified below, $ git branch foo * master $ git branch -m foo foo old fatal: too many branches for a rename operation Change the messages to be more general thus making no assumptions about the "parameters". Signed-off-by: Kaartic Sivaraam <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4010f1d commit f777623

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/branch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,12 +711,12 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
711711
else if (argc == 2)
712712
rename_branch(argv[0], argv[1], rename > 1);
713713
else
714-
die(_("too many branches for a rename operation"));
714+
die(_("too many arguments for a rename operation"));
715715
} else if (new_upstream) {
716716
struct branch *branch = branch_get(argv[0]);
717717

718718
if (argc > 1)
719-
die(_("too many branches to set new upstream"));
719+
die(_("too many arguments to set new upstream"));
720720

721721
if (!branch) {
722722
if (!argc || !strcmp(argv[0], "HEAD"))
@@ -739,7 +739,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
739739
struct strbuf buf = STRBUF_INIT;
740740

741741
if (argc > 1)
742-
die(_("too many branches to unset upstream"));
742+
die(_("too many arguments to unset upstream"));
743743

744744
if (!branch) {
745745
if (!argc || !strcmp(argv[0], "HEAD"))

0 commit comments

Comments
 (0)