{"thread":{"id":"46467","subject":"[PATCH] branch: change the error messages to be more meaningful","startedAt":"2017-07-25T14:39:25Z","lastAt":"2017-10-05T12:14:06Z","messageCount":12,"participants":["Kaartic Sivaraam","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"325041","messageId":"0102015d7a301def-0d802f3e-6052-4e32-b331-c42c3160012b-000000@eu-west-1.amazonses.com","threadId":"46467","inReplyTo":null,"subject":"[PATCH] branch: change the error messages to be more meaningful","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-07-25T14:39:20Z","receivedAt":"2017-07-25T14:39:25Z","isPatch":true,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"The error messages shown when the branch command is misused\nby supplying it wrong number of parameters wasn't meaningful\nas it used the the phrase, \"too many branches\" which is not\nmeaningful in the following case,\n\n        $ git branch\n          foo\n        * master\n\n        $ git branch -m foo foo test\n        fatal: too many branches for a rename operation\n\nIt's not meaningful as the implementation assumed all parameters\nto be branch names. It's not always the case as exemplified above.\n\nChange the messages to be more general thus making no asssumptions\nabout the \"parameters\".\n\nSigned-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>\n---\n builtin/branch.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex a3bd2262b3367..59fedf085d3db 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -707,12 +707,12 @@ 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\tdie(_(\"too many branches for a rename operation\"));\n+\t\t\tdie(_(\"too many parameters for a rename operation\"));\n \t} else if (new_upstream) {\n \t\tstruct branch *branch = branch_get(argv[0]);\n \n \t\tif (argc > 1)\n-\t\t\tdie(_(\"too many branches to set new upstream\"));\n+\t\t\tdie(_(\"too many parameters to set new upstream\"));\n \n \t\tif (!branch) {\n \t\t\tif (!argc || !strcmp(argv[0], \"HEAD\"))\n@@ -735,7 +735,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tstruct strbuf buf = STRBUF_INIT;\n \n \t\tif (argc > 1)\n-\t\t\tdie(_(\"too many branches to unset upstream\"));\n+\t\t\tdie(_(\"too many parameters to unset upstream\"));\n \n \t\tif (!branch) {\n \t\t\tif (!argc || !strcmp(argv[0], \"HEAD\"))\n\n--\nhttps://github.com/git/git/pull/387\n"},{"id":"325049","messageId":"0102015d7b021c6c-8741d523-c7d7-4be5-923a-cd4a925842a0-000000@eu-west-1.amazonses.com","threadId":"46467","inReplyTo":"0102015d7a301def-0d802f3e-6052-4e32-b331-c42c3160012b-000000@eu-west-1.amazonses.com","subject":"[PATCH] branch: change the error messages to be more meaningful","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-07-25T18:28:42Z","receivedAt":"2017-07-25T18:28:48Z","isPatch":true,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"The error messages shown when the branch command is misused\nby supplying it wrong number of parameters wasn't meaningful.\nThat's because it used the the phrase \"too many branches\"\nassuming all parameters to be \"valid\" branch names. It's not\nalways the case as exemplified below,\n\n        $ git branch\n          foo\n        * master\n\n        $ git branch -m foo foo old\n        fatal: too many branches for a rename operation\n\nChange the messages to be more general thus making no assumptions\nabout the \"parameters\".\n\nSigned-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>\n---\n builtin/branch.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex a3bd2262b3367..59fedf085d3db 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -707,12 +707,12 @@ 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\tdie(_(\"too many branches for a rename operation\"));\n+\t\t\tdie(_(\"too many parameters for a rename operation\"));\n \t} else if (new_upstream) {\n \t\tstruct branch *branch = branch_get(argv[0]);\n \n \t\tif (argc > 1)\n-\t\t\tdie(_(\"too many branches to set new upstream\"));\n+\t\t\tdie(_(\"too many parameters to set new upstream\"));\n \n \t\tif (!branch) {\n \t\t\tif (!argc || !strcmp(argv[0], \"HEAD\"))\n@@ -735,7 +735,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tstruct strbuf buf = STRBUF_INIT;\n \n \t\tif (argc > 1)\n-\t\t\tdie(_(\"too many branches to unset upstream\"));\n+\t\t\tdie(_(\"too many parameters to unset upstream\"));\n \n \t\tif (!branch) {\n \t\t\tif (!argc || !strcmp(argv[0], \"HEAD\"))\n\n--\nhttps://github.com/git/git/pull/389\n"},{"id":"325053","messageId":"1501007517.11979.4.camel@gmail.com","threadId":"46467","inReplyTo":"0102015d7b021c6c-8741d523-c7d7-4be5-923a-cd4a925842a0-000000@eu-west-1.amazonses.com","subject":"Re: [PATCH] branch: change the error messages to be more meaningful","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-07-25T18:31:57Z","receivedAt":"2017-07-25T18:31:36Z","isPatch":true,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"The second patch differs from the first one only in the commit message.\n\n-- \nKaartic\n"},{"id":"325274","messageId":"20170730115908.13841-1-kaarticsivaraam91196@gmail.com","threadId":"46467","inReplyTo":"0102015d7b021c6c-8741d523-c7d7-4be5-923a-cd4a925842a0-000000@eu-west-1.amazonses.com","subject":"[PATCH] branch: change the error messages to be more meaningful","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-07-30T11:59:08Z","receivedAt":"2017-07-30T11:58:59Z","isPatch":true,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"The error messages shown when the branch command is misused\nby supplying it wrong number of parameters wasn't meaningful.\nThat's because it used the the phrase \"too many branches\"\nassuming all parameters to be \"valid\" branch names. It's not\nalways the case as exemplified below,\n\n        $ git branch\n          foo\n        * master\n\n        $ git branch -m foo foo old\n        fatal: too many branches for a rename operation\n\nChange the messages to be more general thus making no assumptions\nabout the \"parameters\".\n\nSigned-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>\n---\n Sending this patch to the correct thread. I apologise if this\n seems reduntant. I'm having hard time keeping up with the patch-flow\n without 'send-email'!\n\n builtin/branch.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex a3bd2262b..59fedf085 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -707,12 +707,12 @@ 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\tdie(_(\"too many branches for a rename operation\"));\n+\t\t\tdie(_(\"too many parameters for a rename operation\"));\n \t} else if (new_upstream) {\n \t\tstruct branch *branch = branch_get(argv[0]);\n \n \t\tif (argc > 1)\n-\t\t\tdie(_(\"too many branches to set new upstream\"));\n+\t\t\tdie(_(\"too many parameters to set new upstream\"));\n \n \t\tif (!branch) {\n \t\t\tif (!argc || !strcmp(argv[0], \"HEAD\"))\n@@ -735,7 +735,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tstruct strbuf buf = STRBUF_INIT;\n \n \t\tif (argc > 1)\n-\t\t\tdie(_(\"too many branches to unset upstream\"));\n+\t\t\tdie(_(\"too many parameters to unset upstream\"));\n \n \t\tif (!branch) {\n \t\t\tif (!argc || !strcmp(argv[0], \"HEAD\"))\n-- \n2.14.0.rc1.434.g6eded367a\n\n"},{"id":"326874","messageId":"20170821133608.5652-1-kaarticsivaraam91196@gmail.com","threadId":"46467","inReplyTo":"20170730115908.13841-1-kaarticsivaraam91196@gmail.com","subject":"[PATCH v2] branch: change the error messages to be more meaningful","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-08-21T13:36:08Z","receivedAt":"2017-08-21T13:35:39Z","isPatch":true,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"The error messages shown when the branch command is misused\nby supplying it wrong number of parameters wasn't meaningful.\nThat's because it used the the phrase \"too many branches\"\nassuming all parameters to be \"valid\" branch names. It's not\nalways the case as exemplified below,\n\n        $ git branch\n          foo\n        * master\n\n        $ git branch -m foo foo old\n        fatal: too many branches for a rename operation\n\nChange the messages to be more general thus making no assumptions\nabout the \"parameters\".\n\nSigned-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>\n---\n Changes in v2:\n\n    - changed the wordings of the error message\n\n builtin/branch.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex a3bd2262b..62981d358 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -707,12 +707,12 @@ 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\tdie(_(\"too many branches for a rename operation\"));\n+\t\t\tdie(_(\"too many arguments for a rename operation\"));\n \t} else if (new_upstream) {\n \t\tstruct branch *branch = branch_get(argv[0]);\n \n \t\tif (argc > 1)\n-\t\t\tdie(_(\"too many branches to set new upstream\"));\n+\t\t\tdie(_(\"too many arguments to set new upstream\"));\n \n \t\tif (!branch) {\n \t\t\tif (!argc || !strcmp(argv[0], \"HEAD\"))\n@@ -735,7 +735,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tstruct strbuf buf = STRBUF_INIT;\n \n \t\tif (argc > 1)\n-\t\t\tdie(_(\"too many branches to unset upstream\"));\n+\t\t\tdie(_(\"too many arguments to unset upstream\"));\n \n \t\tif (!branch) {\n \t\t\tif (!argc || !strcmp(argv[0], \"HEAD\"))\n-- \n2.14.0.rc1.434.g6eded367a\n\n"},{"id":"329466","messageId":"1506964786.3504.3.camel@gmail.com","threadId":"46467","inReplyTo":"20170821133608.5652-1-kaarticsivaraam91196@gmail.com","subject":"Re: [PATCH v2] branch: change the error messages to be more meaningful","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-10-02T17:19:46Z","receivedAt":"2017-10-02T17:19:59Z","isPatch":true,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"On Mon, 2017-08-21 at 19:06 +0530, Kaartic Sivaraam wrote:\n> The error messages shown when the branch command is misused\n> by supplying it wrong number of parameters wasn't meaningful.\n> That's because it used the the phrase \"too many branches\"\n> assuming all parameters to be \"valid\" branch names. It's not\n> always the case as exemplified below,\n> \n>         $ git branch\n>           foo\n>         * master\n> \n>         $ git branch -m foo foo old\n>         fatal: too many branches for a rename operation\n> \n> Change the messages to be more general thus making no assumptions\n> about the \"parameters\".\n> \n> Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>\n> ---\n>  Changes in v2:\n> \n>     - changed the wordings of the error message\n> \n>  builtin/branch.c | 6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n> \n> diff --git a/builtin/branch.c b/builtin/branch.c\n> index a3bd2262b..62981d358 100644\n> --- a/builtin/branch.c\n> +++ b/builtin/branch.c\n> @@ -707,12 +707,12 @@ 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\tdie(_(\"too many branches for a rename operation\"));\n> +\t\t\tdie(_(\"too many arguments for a rename operation\"));\n>  \t} else if (new_upstream) {\n>  \t\tstruct branch *branch = branch_get(argv[0]);\n>  \n>  \t\tif (argc > 1)\n> -\t\t\tdie(_(\"too many branches to set new upstream\"));\n> +\t\t\tdie(_(\"too many arguments to set new upstream\"));\n>  \n>  \t\tif (!branch) {\n>  \t\t\tif (!argc || !strcmp(argv[0], \"HEAD\"))\n> @@ -735,7 +735,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n>  \t\tstruct strbuf buf = STRBUF_INIT;\n>  \n>  \t\tif (argc > 1)\n> -\t\t\tdie(_(\"too many branches to unset upstream\"));\n> +\t\t\tdie(_(\"too many arguments to unset upstream\"));\n>  \n>  \t\tif (!branch) {\n>  \t\t\tif (!argc || !strcmp(argv[0], \"HEAD\"))\n\n\nI was recently searching to find the patches have gone missing in to\nthe void for no obvious reason and found this. Should I consider this\nto be \"Dropped\" in terms of the \"What's cooking\" emails? or has this\njust not received the required attention?\n\n---\nKaartic\n"},{"id":"329503","messageId":"xmqqbmlpm67l.fsf@gitster.mtv.corp.google.com","threadId":"46467","inReplyTo":"1506964786.3504.3.camel@gmail.com","subject":"Re: [PATCH v2] branch: change the error messages to be more meaningful","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-10-03T00:21:34Z","receivedAt":"2017-10-03T00:21:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> writes:\n\n> I was recently searching to find the patches have gone missing in to\n> the void for no obvious reason and found this. Should I consider this\n> to be \"Dropped\" in terms of the \"What's cooking\" emails? or has this\n> just not received the required attention?\n\nI do not even recall what the patches did and if I thought what they\nwanted to do made sense, so I wouldn't be surprised if I did not\npick them up, after seeing nobody's commenting on it.\n\n"},{"id":"329584","messageId":"1507058081.7360.5.camel@gmail.com","threadId":"46467","inReplyTo":"xmqqbmlpm67l.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] branch: change the error messages to be more meaningful","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-10-03T19:14:41Z","receivedAt":"2017-10-03T19:14:53Z","isPatch":true,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"On Tue, 2017-10-03 at 09:21 +0900, Junio C Hamano wrote:\n> Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> writes:\n> \n> I do not even recall what the patches did and if I thought what they\n> wanted to do made sense, \n\n\nI thought you did or may be I misinterpreted the following statement,\n\n\nOn Thursday 17 August 2017 12:58 AM, Junio C Hamano wrote:\n> I do not find the s/branch/parameter/ too bad (although I would have\n> said \"arguments\" instead).\n>\n\nI interpreted the \"not .. too bad\" as a \"it makes little sense\". So,\npinged the thread.\n\n---\nKaartic\n"},{"id":"329642","messageId":"xmqqwp4beemb.fsf@gitster.mtv.corp.google.com","threadId":"46467","inReplyTo":"1507058081.7360.5.camel@gmail.com","subject":"Re: [PATCH v2] branch: change the error messages to be more meaningful","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-10-04T04:11:40Z","receivedAt":"2017-10-04T04:11:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> writes:\n\n> I interpreted the \"not .. too bad\" as a \"it makes little sense\". So,\n> pinged the thread.\n\nThanks.  I think what the patch does (sort of) makes sense.  \n\nIt is a bit dissapointing that we do not need to touch tests, as it\nindicates that the logic to diagnose extra arguments as an error has\nno coverage.\n"},{"id":"329681","messageId":"1507121174.2245.3.camel@gmail.com","threadId":"46467","inReplyTo":"xmqqwp4beemb.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] branch: change the error messages to be more meaningful","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-10-04T12:46:14Z","receivedAt":"2017-10-04T12:47:36Z","isPatch":true,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"On Wed, 2017-10-04 at 13:11 +0900, Junio C Hamano wrote:\n> \n> It is a bit dissapointing that we do not need to touch tests, as it\n> indicates that the logic to diagnose extra arguments as an error has\n> no coverage.\n\nEven if there were tests I don't think they would have needed any\nupdation as most of the tests (at least those that I came across) that\ncheck for failure seem not to be checking for what error message gets\nprinted. They seem to test only if the command fails (using\ntest_must_fail in most cases, I guess).\n\nMoreover, as a consequence of my assumption that the tests don't check\nfor the error messages themselves; I haven't even thought of checking\nwhether the tests or the travis-ci build succeeded as a consequence of\nmy patches that touch \"only\" the error messages!\n\n---\nKaartic\n"},{"id":"329710","messageId":"xmqqmv569z25.fsf@gitster.mtv.corp.google.com","threadId":"46467","inReplyTo":"1507121174.2245.3.camel@gmail.com","subject":"Re: [PATCH v2] branch: change the error messages to be more meaningful","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-10-05T01:13:38Z","receivedAt":"2017-10-05T01:13:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> writes:\n\n> Moreover, as a consequence of my assumption that the tests don't check\n> for the error messages themselves; I haven't even thought of checking\n> whether the tests or the travis-ci build succeeded as a consequence of\n> my patches that touch \"only\" the error messages!\n\nThat's a bad thing, right?\n"},{"id":"329757","messageId":"1507205634.2364.2.camel@gmail.com","threadId":"46467","inReplyTo":"xmqqmv569z25.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] branch: change the error messages to be more meaningful","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-10-05T12:13:54Z","receivedAt":"2017-10-05T12:14:06Z","isPatch":true,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"On Thu, 2017-10-05 at 10:13 +0900, Junio C Hamano wrote:\n> Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> writes:\n> \n> > Moreover, as a consequence of my assumption that the tests don't check\n> > for the error messages themselves; I haven't even thought of checking\n> > whether the tests or the travis-ci build succeeded as a consequence of\n> > my patches that touch \"only\" the error messages!\n> \n> That's a bad thing, right?\n\nMight be, but my assumption seems to held at least until now for the\ntwo or three patches that I have sent that touch \"only\" the error\nmessages (I haven't received emails from anyone shouting at me that the\nbuild fails as a consequence of one such patches).\n\nThe build status for this patch can be found at [1]. Supporting my\nassumption, it passed too.\n\nThat said, you don't have to worry a lot about this. I'll come over my\nlaziness and check if the travis-ci build passes for such patches in\nthe future :-)\n\n[1]: https://travis-ci.org/sivaraam/git/builds/276222235\n\n---\nKaartic\n\n"}]}