{"thread":{"id":"32722","subject":"[PATCH] branch: reject -D/-d without branch name","startedAt":"2013-01-25T08:26:56Z","lastAt":"2013-01-28T01:18:16Z","messageCount":14,"participants":["Nguyễn Thái Ngọc Duy","Matthieu Moy","Duy Nguyen","Junio C Hamano","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"207771","messageId":"1359102416-1240-1-git-send-email-pclouds@gmail.com","threadId":"32722","inReplyTo":null,"subject":"[PATCH] branch: reject -D/-d without branch name","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-01-25T08:26:56Z","receivedAt":"2013-01-25T08:26:56Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/branch.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 873f624..1d3e842 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tcolopts = 0;\n \t}\n \n-\tif (delete)\n+\tif (delete && argc)\n \t\treturn delete_branches(argc, argv, delete > 1, kinds, quiet);\n \telse if (list) {\n \t\tint ret = print_ref_list(kinds, detached, verbose, abbrev,\n-- \n1.8.1.1.380.g782aa97\n"},{"id":"207773","messageId":"vpqmwvxhcra.fsf@grenoble-inp.fr","threadId":"32722","inReplyTo":"1359102416-1240-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH] branch: reject -D/-d without branch name","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-01-25T08:45:29Z","receivedAt":"2013-01-25T08:45:29Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n\n> diff --git a/builtin/branch.c b/builtin/branch.c\n> index 873f624..1d3e842 100644\n> --- a/builtin/branch.c\n> +++ b/builtin/branch.c\n> @@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n>  \t\tcolopts = 0;\n>  \t}\n>  \n> -\tif (delete)\n> +\tif (delete && argc)\n>  \t\treturn delete_branches(argc, argv, delete > 1, kinds, quiet);\n>  \telse if (list) {\n>  \t\tint ret = print_ref_list(kinds, detached, verbose, abbrev,\n\nShouldn't this error out with a clean error message (\"branch name\nexpected\" or so)?\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"207774","messageId":"CACsJy8AyDKEFG511e70vB7YrwLP4xoWmE34tqazMZA59hs6iHA@mail.gmail.com","threadId":"32722","inReplyTo":"vpqmwvxhcra.fsf@grenoble-inp.fr","subject":"Re: [PATCH] branch: reject -D/-d without branch name","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-01-25T08:56:41Z","receivedAt":"2013-01-25T08:56:41Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Jan 25, 2013 at 3:45 PM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n>\n>> diff --git a/builtin/branch.c b/builtin/branch.c\n>> index 873f624..1d3e842 100644\n>> --- a/builtin/branch.c\n>> +++ b/builtin/branch.c\n>> @@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n>>               colopts = 0;\n>>       }\n>>\n>> -     if (delete)\n>> +     if (delete && argc)\n>>               return delete_branches(argc, argv, delete > 1, kinds, quiet);\n>>       else if (list) {\n>>               int ret = print_ref_list(kinds, detached, verbose, abbrev,\n>\n> Shouldn't this error out with a clean error message (\"branch name\n> expected\" or so)?\n\nYeah. But on the other hand, this command seems to prefer to print\nhelp usage when incorrect number of arguments is given (checkout\nblocks \"if (edit_description)\" and \"if (rename)\" in cmd_branch).\nShould those be fixed too?\n-- \nDuy\n"},{"id":"207804","messageId":"1359118225-14356-1-git-send-email-pclouds@gmail.com","threadId":"32722","inReplyTo":"1359102416-1240-1-git-send-email-pclouds@gmail.com","subject":"[PATCH v2 1/3] branch: reject -D/-d without branch name","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-01-25T12:50:23Z","receivedAt":"2013-01-25T12:50:23Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n builtin/branch.c | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 873f624..50fcacc 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -837,9 +837,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tcolopts = 0;\n \t}\n \n-\tif (delete)\n+\tif (delete) {\n+\t\tif (!argc)\n+\t\t\tdie(_(\"branch name required\"));\n \t\treturn delete_branches(argc, argv, delete > 1, kinds, quiet);\n-\telse if (list) {\n+\t} else if (list) {\n \t\tint ret = print_ref_list(kinds, detached, verbose, abbrev,\n \t\t\t\t\t with_commit, argv);\n \t\tprint_columns(&output, colopts, NULL);\n-- \n1.8.0.rc2.23.g1fb49df\n"},{"id":"207805","messageId":"1359118225-14356-2-git-send-email-pclouds@gmail.com","threadId":"32722","inReplyTo":"1359118225-14356-1-git-send-email-pclouds@gmail.com","subject":"[PATCH v2 2/3] branch: give a more helpful message on redundant arguments","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-01-25T12:50:24Z","receivedAt":"2013-01-25T12:50:24Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"While at there, do not stop user from editing a branch description\nwhen the unrelated HEAD is detached.\n---\n builtin/branch.c  | 12 ++++++------\n t/t3200-branch.sh |  4 ++--\n 2 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 50fcacc..ca61c5b 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -852,14 +852,14 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tconst char *branch_name;\n \t\tstruct strbuf branch_ref = STRBUF_INIT;\n \n-\t\tif (detached)\n-\t\t\tdie(\"Cannot give description to detached HEAD\");\n-\t\tif (!argc)\n+\t\tif (!argc) {\n+\t\t\tif (detached)\n+\t\t\t\tdie(\"Cannot give description to detached HEAD\");\n \t\t\tbranch_name = head;\n-\t\telse if (argc == 1)\n+\t\t} else if (argc == 1)\n \t\t\tbranch_name = argv[0];\n \t\telse\n-\t\t\tusage_with_options(builtin_branch_usage, options);\n+\t\t\tdie(_(\"cannot edit description of more than one branch\"));\n \n \t\tstrbuf_addf(&branch_ref, \"refs/heads/%s\", branch_name);\n \t\tif (!ref_exists(branch_ref.buf)) {\n@@ -881,7 +881,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\telse if (argc == 2)\n \t\t\trename_branch(argv[0], argv[1], rename > 1);\n \t\telse\n-\t\t\tusage_with_options(builtin_branch_usage, options);\n+\t\t\tdie(_(\"too many branches for a rename operation\"));\n \t} else if (new_upstream) {\n \t\tstruct branch *branch = branch_get(argv[0]);\n \ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex 80e6be3..f3e0e4a 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -73,8 +73,8 @@ test_expect_success \\\n \n test_expect_success \\\n     'git branch -m dumps usage' \\\n-       'test_expect_code 129 git branch -m 2>err &&\n-\ttest_i18ngrep \"[Uu]sage: git branch\" err'\n+       'test_expect_code 128 git branch -m 2>err &&\n+\ttest_i18ngrep \"too many branches for a rename operation\" err'\n \n test_expect_success \\\n     'git branch -m m m/m should work' \\\n-- \n1.8.0.rc2.23.g1fb49df\n"},{"id":"207806","messageId":"1359118225-14356-3-git-send-email-pclouds@gmail.com","threadId":"32722","inReplyTo":"1359118225-14356-1-git-send-email-pclouds@gmail.com","subject":"[PATCH v2 3/3] branch: mark more strings for translation","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-01-25T12:50:25Z","receivedAt":"2013-01-25T12:50:25Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n builtin/branch.c | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex ca61c5b..597b578 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -466,7 +466,7 @@ static void add_verbose_info(struct strbuf *out, struct ref_item *item,\n \t\t\t     int verbose, int abbrev)\n {\n \tstruct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;\n-\tconst char *sub = \" **** invalid ref ****\";\n+\tconst char *sub = _(\" **** invalid ref ****\");\n \tstruct commit *commit = item->commit;\n \n \tif (commit && !parse_commit(commit)) {\n@@ -590,7 +590,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru\n \t\tstruct commit *filter;\n \t\tfilter = lookup_commit_reference_gently(merge_filter_ref, 0);\n \t\tif (!filter)\n-\t\t\tdie(\"object '%s' does not point to a commit\",\n+\t\t\tdie(_(\"object '%s' does not point to a commit\"),\n \t\t\t    sha1_to_hex(merge_filter_ref));\n \n \t\tfilter->object.flags |= UNINTERESTING;\n@@ -854,7 +854,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \n \t\tif (!argc) {\n \t\t\tif (detached)\n-\t\t\t\tdie(\"Cannot give description to detached HEAD\");\n+\t\t\t\tdie(_(\"Cannot give description to detached HEAD\"));\n \t\t\tbranch_name = head;\n \t\t} else if (argc == 1)\n \t\t\tbranch_name = argv[0];\n@@ -866,10 +866,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\t\tstrbuf_release(&branch_ref);\n \n \t\t\tif (!argc)\n-\t\t\t\treturn error(\"No commit on branch '%s' yet.\",\n+\t\t\t\treturn error(_(\"No commit on branch '%s' yet.\"),\n \t\t\t\t\t     branch_name);\n \t\t\telse\n-\t\t\t\treturn error(\"No such branch '%s'.\", branch_name);\n+\t\t\t\treturn error(_(\"No branch named '%s'.\"),\n+\t\t\t\t\t     branch_name);\n \t\t}\n \t\tstrbuf_release(&branch_ref);\n \n-- \n1.8.0.rc2.23.g1fb49df\n"},{"id":"207825","messageId":"7vham53x01.fsf@alter.siamese.dyndns.org","threadId":"32722","inReplyTo":"1359118225-14356-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH v2 1/3] branch: reject -D/-d without branch name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-25T19:04:14Z","receivedAt":"2013-01-25T19:04:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n\n> ---\n>  builtin/branch.c | 6 ++++--\n>  1 file changed, 4 insertions(+), 2 deletions(-)\n\nForgot to sign-off?\n\nIs this a real problem?\n\nI do not see it particularly wrong to succeed after deleting 0 or\nmore given branch names.\n\n>\n> diff --git a/builtin/branch.c b/builtin/branch.c\n> index 873f624..50fcacc 100644\n> --- a/builtin/branch.c\n> +++ b/builtin/branch.c\n> @@ -837,9 +837,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n>  \t\tcolopts = 0;\n>  \t}\n>  \n> -\tif (delete)\n> +\tif (delete) {\n> +\t\tif (!argc)\n> +\t\t\tdie(_(\"branch name required\"));\n>  \t\treturn delete_branches(argc, argv, delete > 1, kinds, quiet);\n> -\telse if (list) {\n> +\t} else if (list) {\n>  \t\tint ret = print_ref_list(kinds, detached, verbose, abbrev,\n>  \t\t\t\t\t with_commit, argv);\n>  \t\tprint_columns(&output, colopts, NULL);\n"},{"id":"207865","messageId":"CACsJy8B1YS6EDNFzDL3zJiy5tb3Qn=0xxyZgSnQh4KM6yNNKpw@mail.gmail.com","threadId":"32722","inReplyTo":"7vham53x01.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 1/3] branch: reject -D/-d without branch name","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-01-26T03:12:51Z","receivedAt":"2013-01-26T03:12:51Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Jan 26, 2013 at 2:04 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n>\n>> ---\n>>  builtin/branch.c | 6 ++++--\n>>  1 file changed, 4 insertions(+), 2 deletions(-)\n>\n> Forgot to sign-off?\n\nYes\n\n> Is this a real problem?\n\nYes. My thoughts yesterday when I happened to type \"git branch -D\":\n\n\"Wait, I just entered a delete command without a branch name. It did\nnot report anything, which in UNIX world usually means successful\noperation. _What_ did it delete??\"\n\nI knew this code so I just went check. If I did not know, I might as\nwell list all branches I had and see if something was missing. A short\nmessage would have saved me the trouble.\n\n> I do not see it particularly wrong to succeed after deleting 0 or\n> more given branch names.\n-- \nDuy\n"},{"id":"207947","messageId":"20130127115516.GD4228@elie.Belkin","threadId":"32722","inReplyTo":"1359118225-14356-3-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH v2 3/3] branch: mark more strings for translation","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-01-27T11:55:16Z","receivedAt":"2013-01-27T11:55:16Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Nguyễn Thái Ngọc Duy wrote:\n\n> --- a/builtin/branch.c\n> +++ b/builtin/branch.c\n> @@ -466,7 +466,7 @@ static void add_verbose_info(struct strbuf *out, struct ref_item *item,\n>  \t\t\t     int verbose, int abbrev)\n>  {\n>  \tstruct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;\n> -\tconst char *sub = \" **** invalid ref ****\";\n> +\tconst char *sub = _(\" **** invalid ref ****\");\n\nThis worried me for a second --- is it an actual message that gets\nemitted, a placeholder used only in code, or some combination of\nthe two?\n\nLuckily it really is just a message (or rather, a value for the commit\nmessage column in the \" f7c0c00 [ahead 58, behind 197] vcs-svn: drop\nobj_pool.h\" message).\n\nFor what it's worth, assuming this passes tests,\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"207946","messageId":"20130127115831.GE4228@elie.Belkin","threadId":"32722","inReplyTo":"1359118225-14356-2-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH v2 2/3] branch: give a more helpful message on redundant arguments","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-01-27T11:58:31Z","receivedAt":"2013-01-27T11:58:31Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Nguyễn Thái Ngọc Duy wrote:\n\n> --- a/builtin/branch.c\n> +++ b/builtin/branch.c\n> @@ -852,14 +852,14 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n>  \t\tconst char *branch_name;\n>  \t\tstruct strbuf branch_ref = STRBUF_INIT;\n>  \n> -\t\tif (detached)\n> -\t\t\tdie(\"Cannot give description to detached HEAD\");\n> -\t\tif (!argc)\n> +\t\tif (!argc) {\n> +\t\t\tif (detached)\n> +\t\t\t\tdie(\"Cannot give description to detached HEAD\");\n\nGood catch.  Shouldn't this bugfix be a separate patch, so it can also\nbe included in maint?\n"},{"id":"208030","messageId":"1359335896-24406-1-git-send-email-pclouds@gmail.com","threadId":"32722","inReplyTo":"1359118225-14356-1-git-send-email-pclouds@gmail.com","subject":"[PATCH v3 1/4] branch: no detached HEAD check when editing another branch's description","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-01-28T01:18:13Z","receivedAt":"2013-01-28T01:18:13Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Split out from v3's 2/3 as Jonathan suggested.\n\n builtin/branch.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 873f624..ea6498b 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -850,11 +850,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tconst char *branch_name;\n \t\tstruct strbuf branch_ref = STRBUF_INIT;\n \n-\t\tif (detached)\n-\t\t\tdie(\"Cannot give description to detached HEAD\");\n-\t\tif (!argc)\n+\t\tif (!argc) {\n+\t\t\tif (detached)\n+\t\t\t\tdie(\"Cannot give description to detached HEAD\");\n \t\t\tbranch_name = head;\n-\t\telse if (argc == 1)\n+\t\t} else if (argc == 1)\n \t\t\tbranch_name = argv[0];\n \t\telse\n \t\t\tusage_with_options(builtin_branch_usage, options);\n-- \n1.8.1.1.459.g5970e58\n"},{"id":"208031","messageId":"1359335896-24406-2-git-send-email-pclouds@gmail.com","threadId":"32722","inReplyTo":"1359335896-24406-1-git-send-email-pclouds@gmail.com","subject":"[PATCH v3 2/4] branch: reject -D/-d without branch name","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-01-28T01:18:14Z","receivedAt":"2013-01-28T01:18:14Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/branch.c | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex ea6498b..30c4545 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -837,9 +837,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tcolopts = 0;\n \t}\n \n-\tif (delete)\n+\tif (delete) {\n+\t\tif (!argc)\n+\t\t\tdie(_(\"branch name required\"));\n \t\treturn delete_branches(argc, argv, delete > 1, kinds, quiet);\n-\telse if (list) {\n+\t} else if (list) {\n \t\tint ret = print_ref_list(kinds, detached, verbose, abbrev,\n \t\t\t\t\t with_commit, argv);\n \t\tprint_columns(&output, colopts, NULL);\n-- \n1.8.1.1.459.g5970e58\n"},{"id":"208028","messageId":"1359335896-24406-3-git-send-email-pclouds@gmail.com","threadId":"32722","inReplyTo":"1359335896-24406-1-git-send-email-pclouds@gmail.com","subject":"[PATCH v3 3/4] branch: give a more helpful message on redundant arguments","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-01-28T01:18:15Z","receivedAt":"2013-01-28T01:18:15Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/branch.c  | 4 ++--\n t/t3200-branch.sh | 4 ++--\n 2 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 30c4545..ca61c5b 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -859,7 +859,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\t} else if (argc == 1)\n \t\t\tbranch_name = argv[0];\n \t\telse\n-\t\t\tusage_with_options(builtin_branch_usage, options);\n+\t\t\tdie(_(\"cannot edit description of more than one branch\"));\n \n \t\tstrbuf_addf(&branch_ref, \"refs/heads/%s\", branch_name);\n \t\tif (!ref_exists(branch_ref.buf)) {\n@@ -881,7 +881,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\telse if (argc == 2)\n \t\t\trename_branch(argv[0], argv[1], rename > 1);\n \t\telse\n-\t\t\tusage_with_options(builtin_branch_usage, options);\n+\t\t\tdie(_(\"too many branches for a rename operation\"));\n \t} else if (new_upstream) {\n \t\tstruct branch *branch = branch_get(argv[0]);\n \ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex 80e6be3..f3e0e4a 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -73,8 +73,8 @@ test_expect_success \\\n \n test_expect_success \\\n     'git branch -m dumps usage' \\\n-       'test_expect_code 129 git branch -m 2>err &&\n-\ttest_i18ngrep \"[Uu]sage: git branch\" err'\n+       'test_expect_code 128 git branch -m 2>err &&\n+\ttest_i18ngrep \"too many branches for a rename operation\" err'\n \n test_expect_success \\\n     'git branch -m m m/m should work' \\\n-- \n1.8.1.1.459.g5970e58\n"},{"id":"208029","messageId":"1359335896-24406-4-git-send-email-pclouds@gmail.com","threadId":"32722","inReplyTo":"1359335896-24406-1-git-send-email-pclouds@gmail.com","subject":"[PATCH v3 4/4] branch: mark more strings for translation","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-01-28T01:18:16Z","receivedAt":"2013-01-28T01:18:16Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n On Sun, Jan 27, 2013 at 6:55 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n > For what it's worth, assuming this passes tests,\n\n It passes the tests. Although I doubt the tests are written to catch\n this.\n\n builtin/branch.c | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex ca61c5b..597b578 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -466,7 +466,7 @@ static void add_verbose_info(struct strbuf *out, struct ref_item *item,\n \t\t\t     int verbose, int abbrev)\n {\n \tstruct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;\n-\tconst char *sub = \" **** invalid ref ****\";\n+\tconst char *sub = _(\" **** invalid ref ****\");\n \tstruct commit *commit = item->commit;\n \n \tif (commit && !parse_commit(commit)) {\n@@ -590,7 +590,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru\n \t\tstruct commit *filter;\n \t\tfilter = lookup_commit_reference_gently(merge_filter_ref, 0);\n \t\tif (!filter)\n-\t\t\tdie(\"object '%s' does not point to a commit\",\n+\t\t\tdie(_(\"object '%s' does not point to a commit\"),\n \t\t\t    sha1_to_hex(merge_filter_ref));\n \n \t\tfilter->object.flags |= UNINTERESTING;\n@@ -854,7 +854,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \n \t\tif (!argc) {\n \t\t\tif (detached)\n-\t\t\t\tdie(\"Cannot give description to detached HEAD\");\n+\t\t\t\tdie(_(\"Cannot give description to detached HEAD\"));\n \t\t\tbranch_name = head;\n \t\t} else if (argc == 1)\n \t\t\tbranch_name = argv[0];\n@@ -866,10 +866,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\t\tstrbuf_release(&branch_ref);\n \n \t\t\tif (!argc)\n-\t\t\t\treturn error(\"No commit on branch '%s' yet.\",\n+\t\t\t\treturn error(_(\"No commit on branch '%s' yet.\"),\n \t\t\t\t\t     branch_name);\n \t\t\telse\n-\t\t\t\treturn error(\"No such branch '%s'.\", branch_name);\n+\t\t\t\treturn error(_(\"No branch named '%s'.\"),\n+\t\t\t\t\t     branch_name);\n \t\t}\n \t\tstrbuf_release(&branch_ref);\n \n-- \n1.8.1.1.459.g5970e58\n"}]}