[PATCH] 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--- Sending this patch to the correct thread. I apologise if this seems reduntant. I'm having hard time keeping up with the patch-flow without 'send-email'! builtin/branch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/branch.c b/builtin/branch.c index a3bd2262b..59fedf085 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -707,12 +707,12 @@ int cmd_branch(int argc, const char **argv, const char *prefix) else if (argc == 2) rename_branch(argv[0], argv[1], rename > 1); else - die(_("too many branches for a rename operation")); + die(_("too many parameters for a rename operation")); } else if (new_upstream) { struct branch *branch = branch_get(argv[0]); if (argc > 1) - die(_("too many branches to set new upstream")); + die(_("too many parameters to set new upstream")); if (!branch) { if (!argc || !strcmp(argv[0], "HEAD")) @@ -735,7 +735,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix) struct strbuf buf = STRBUF_INIT; if (argc > 1) - die(_("too many branches to unset upstream")); + die(_("too many parameters to unset upstream")); if (!branch) { if (!argc || !strcmp(argv[0], "HEAD")) -- 2.14.0.rc1.434.g6eded367a
[PATCH] 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--- builtin/branch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/branch.c b/builtin/branch.c index a3bd2262b..59fedf085 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -707,12 +707,12 @@ int cmd_branch(int argc, const char **argv, const char *prefix) else if (argc == 2) rename_branch(argv[0], argv[1], rename > 1); else - die(_("too many branches for a rename operation")); + die(_("too many parameters for a rename operation")); } else if (new_upstream) { struct branch *branch = branch_get(argv[0]); if (argc > 1) - die(_("too many branches to set new upstream")); + die(_("too many parameters to set new upstream")); if (!branch) { if (!argc || !strcmp(argv[0], "HEAD")) @@ -735,7 +735,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix) struct strbuf buf = STRBUF_INIT; if (argc > 1) - die(_("too many branches to unset upstream")); + die(_("too many parameters to unset upstream")); if (!branch) { if (!argc || !strcmp(argv[0], "HEAD")) -- 2.14.0.rc1.434.g6eded367a
Re: [PATCH] branch: change the error messages to be more meaningful
The second patch differs from the first one only in the commit message. -- Kaartic
[PATCH] 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--- builtin/branch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/branch.c b/builtin/branch.c index a3bd2262b3367..59fedf085d3db 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -707,12 +707,12 @@ int cmd_branch(int argc, const char **argv, const char *prefix) else if (argc == 2) rename_branch(argv[0], argv[1], rename > 1); else - die(_("too many branches for a rename operation")); + die(_("too many parameters for a rename operation")); } else if (new_upstream) { struct branch *branch = branch_get(argv[0]); if (argc > 1) - die(_("too many branches to set new upstream")); + die(_("too many parameters to set new upstream")); if (!branch) { if (!argc || !strcmp(argv[0], "HEAD")) @@ -735,7 +735,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix) struct strbuf buf = STRBUF_INIT; if (argc > 1) - die(_("too many branches to unset upstream")); + die(_("too many parameters to unset upstream")); if (!branch) { if (!argc || !strcmp(argv[0], "HEAD")) -- https://github.com/git/git/pull/389
[PATCH] 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 as it used the the phrase, "too many branches" which is not meaningful in the following case, $ git branch foo * master $ git branch -m foo foo test fatal: too many branches for a rename operation It's not meaningful as the implementation assumed all parameters to be branch names. It's not always the case as exemplified above. Change the messages to be more general thus making no asssumptions about the "parameters". Signed-off-by: Kaartic Sivaraam--- builtin/branch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/branch.c b/builtin/branch.c index a3bd2262b3367..59fedf085d3db 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -707,12 +707,12 @@ int cmd_branch(int argc, const char **argv, const char *prefix) else if (argc == 2) rename_branch(argv[0], argv[1], rename > 1); else - die(_("too many branches for a rename operation")); + die(_("too many parameters for a rename operation")); } else if (new_upstream) { struct branch *branch = branch_get(argv[0]); if (argc > 1) - die(_("too many branches to set new upstream")); + die(_("too many parameters to set new upstream")); if (!branch) { if (!argc || !strcmp(argv[0], "HEAD")) @@ -735,7 +735,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix) struct strbuf buf = STRBUF_INIT; if (argc > 1) - die(_("too many branches to unset upstream")); + die(_("too many parameters to unset upstream")); if (!branch) { if (!argc || !strcmp(argv[0], "HEAD")) -- https://github.com/git/git/pull/387