{"thread":{"id":"33338","subject":"[PATCH] branch: give better message when no names specified for rename","startedAt":"2013-03-31T01:27:44Z","lastAt":"2013-04-01T03:06:56Z","messageCount":4,"participants":["Jonathon Mah","Duy Nguyen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"212713","messageId":"00E97900-F00D-455F-A3EB-52D0A3CF5CF6@JonathonMah.com","threadId":"33338","inReplyTo":null,"subject":"[PATCH] branch: give better message when no names specified for rename","fromName":"Jonathon Mah","fromEmail":"me@jonathonmah.com","sentAt":"2013-03-31T01:27:44Z","receivedAt":"2013-03-31T01:27:44Z","isPatch":true,"sender":{"key":"me@jonathonmah.com","avatar":"https://avatars.githubusercontent.com/u/2748?v=4"},"body":"Signed-off-by: Jonathon Mah <me@JonathonMah.com>\n---\n\nThe previous message was incorrect when not enough arguments were\nspecified:\n    \n    $ git branch -m \n    fatal: too many branches for a rename operation\n\nI changed to \"branch name required\" instead of \"new branch name required\" in the hope that existing translations can be used.\n\n builtin/branch.c | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 00d17d2..580107f 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -880,7 +880,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tif (edit_branch_description(branch_name))\n \t\t\treturn 1;\n \t} else if (rename) {\n-\t\tif (argc == 1)\n+\t\tif (!argc)\n+\t\t\tdie(_(\"branch name required\"));\n+\t\telse if (argc == 1)\n \t\t\trename_branch(head, argv[0], rename > 1);\n \t\telse if (argc == 2)\n \t\t\trename_branch(argv[0], argv[1], rename > 1);\n-- \n1.8.2.279.g631bc94\n"},{"id":"212714","messageId":"CACsJy8Bs0pBmoMjXB9rStb8_b5tQ1Tb8xT62EuFFj71osKR9Jg@mail.gmail.com","threadId":"33338","inReplyTo":"00E97900-F00D-455F-A3EB-52D0A3CF5CF6@JonathonMah.com","subject":"Re: [PATCH] branch: give better message when no names specified for rename","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-03-31T01:35:39Z","receivedAt":"2013-03-31T01:35:39Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sun, Mar 31, 2013 at 8:27 AM, Jonathon Mah <me@jonathonmah.com> wrote:\n> -               if (argc == 1)\n> +               if (!argc)\n> +                       die(_(\"branch name required\"));\n> +               else if (argc == 1)\n>                         rename_branch(head, argv[0], rename > 1);\n>                 else if (argc == 2)\n>                         rename_branch(argv[0], argv[1], rename > 1);\n\nThis makes four branches based on argc. Maybe we should convert\nif/else chain to switch/case.\n--\nDuy\n"},{"id":"212774","messageId":"7vfvzbm08m.fsf@alter.siamese.dyndns.org","threadId":"33338","inReplyTo":"00E97900-F00D-455F-A3EB-52D0A3CF5CF6@JonathonMah.com","subject":"Re: [PATCH] branch: give better message when no names specified for rename","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-01T02:51:53Z","receivedAt":"2013-04-01T02:51:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathon Mah <me@JonathonMah.com> writes:\n\n> Signed-off-by: Jonathon Mah <me@JonathonMah.com>\n> ---\n>\n> The previous message was incorrect when not enough arguments were\n> specified:\n>     \n>     $ git branch -m \n>     fatal: too many branches for a rename operation\n>\n> I changed to \"branch name required\" instead of \"new branch name required\" in the hope that existing translations can be used.\n>\n>  builtin/branch.c | 4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n>\n> diff --git a/builtin/branch.c b/builtin/branch.c\n> index 00d17d2..580107f 100644\n> --- a/builtin/branch.c\n> +++ b/builtin/branch.c\n> @@ -880,7 +880,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n>  \t\tif (edit_branch_description(branch_name))\n>  \t\t\treturn 1;\n>  \t} else if (rename) {\n> -\t\tif (argc == 1)\n> +\t\tif (!argc)\n> +\t\t\tdie(_(\"branch name required\"));\n> +\t\telse if (argc == 1)\n>  \t\t\trename_branch(head, argv[0], rename > 1);\n>  \t\telse if (argc == 2)\n>  \t\t\trename_branch(argv[0], argv[1], rename > 1);\n\nObviously a good thing to do; thanks.\n"},{"id":"212775","messageId":"7vbo9zlzjj.fsf@alter.siamese.dyndns.org","threadId":"33338","inReplyTo":"7vfvzbm08m.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] branch: give better message when no names specified for rename","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-01T03:06:56Z","receivedAt":"2013-04-01T03:06:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jonathon Mah <me@JonathonMah.com> writes:\n>\n>> Signed-off-by: Jonathon Mah <me@JonathonMah.com>\n>> ---\n>>\n>> The previous message was incorrect when not enough arguments were\n>> specified:\n>>     \n>>     $ git branch -m \n>>     fatal: too many branches for a rename operation\n>>\n>> I changed to \"branch name required\" instead of \"new branch name required\" in the hope that existing translations can be used.\n>>\n>>  builtin/branch.c | 4 +++-\n>>  1 file changed, 3 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/builtin/branch.c b/builtin/branch.c\n>> index 00d17d2..580107f 100644\n>> --- a/builtin/branch.c\n>> +++ b/builtin/branch.c\n>> @@ -880,7 +880,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n>>  \t\tif (edit_branch_description(branch_name))\n>>  \t\t\treturn 1;\n>>  \t} else if (rename) {\n>> -\t\tif (argc == 1)\n>> +\t\tif (!argc)\n>> +\t\t\tdie(_(\"branch name required\"));\n>> +\t\telse if (argc == 1)\n>>  \t\t\trename_branch(head, argv[0], rename > 1);\n>>  \t\telse if (argc == 2)\n>>  \t\t\trename_branch(argv[0], argv[1], rename > 1);\n>\n> Obviously a good thing to do; thanks.\n\nNext time, please run the testsuite before sending a patch.  I've\nfixed t3200 locally when queuing this patch, so no need to resend\nthis one.\n\nThanks.\n"}]}