{"thread":{"id":"22185","subject":"Re: [BUGFIX] Unbork remote helper execution","startedAt":"2010-01-12T19:53:29Z","lastAt":"2010-01-13T06:56:00Z","messageCount":2,"participants":["Johannes Sixt","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"131407","messageId":"201001122053.29568.j6t@kdbg.org","threadId":"22185","inReplyTo":"1263321344-21237-1-git-send-email-ilari.liusvaara@elisanet.fi","subject":"Re: [BUGFIX] Unbork remote helper execution","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-01-12T19:53:29Z","receivedAt":"2010-01-12T19:53:29Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"[added git@vger]\n\nOn Dienstag, 12. Januar 2010, Ilari Liusvaara wrote:\n> Someone that obiviously didn't test the change did the following (the\n> code blames to me, but I didn't write this):\n>\n> code = start_command(helper);\n> if (code < 0 && errno == ENOENT)\n> \tdie(\"Unable to find remote helper for '%s'\", data->name);\n> else\n> \texit(code);\n>\n> Which is obiviously wrong. The code shouldn't exit if code is 0.\n\nDuh! Sorry for that. Your original code indeed has 'else if (code != 0)'.\n\nThanks for catching this. BTW, the test suite passes nevertheless.\nAren't there any tests that exercise the code path, or do I have them\ndisabled somehow? So, yes: I didn't test the change.\n\nHere is the amended commit that replaces the tip of js/exec-error-report,\nwith some light testing this time.\n--- 8< ---\nFrom: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>\nSubject: [PATCH] Improve error message when a transport helper was not found\n\nPerviously, the error message was:\n\n    git: 'remote-foo' is not a git-command. See 'git --help'.\n\nBy not treating the transport helper as a git command, a more suitable\nerror is reported:\n\n    fatal: Unable to find remote helper for 'foo'\n\nSigned-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n transport-helper.c |   14 ++++++++++----\n 1 files changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 6ece0d9..7dce4a4 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -102,6 +102,7 @@ static struct child_process *get_helper(struct transport *transport)\n \tint refspec_nr = 0;\n \tint refspec_alloc = 0;\n \tint duped;\n+\tint code;\n \n \tif (data->helper)\n \t\treturn data->helper;\n@@ -111,13 +112,18 @@ static struct child_process *get_helper(struct transport *transport)\n \thelper->out = -1;\n \thelper->err = 0;\n \thelper->argv = xcalloc(4, sizeof(*helper->argv));\n-\tstrbuf_addf(&buf, \"remote-%s\", data->name);\n+\tstrbuf_addf(&buf, \"git-remote-%s\", data->name);\n \thelper->argv[0] = strbuf_detach(&buf, NULL);\n \thelper->argv[1] = transport->remote->name;\n \thelper->argv[2] = remove_ext_force(transport->url);\n-\thelper->git_cmd = 1;\n-\tif (start_command(helper))\n-\t\tdie(\"Unable to run helper: git %s\", helper->argv[0]);\n+\thelper->git_cmd = 0;\n+\thelper->silent_exec_failure = 1;\n+\tcode = start_command(helper);\n+\tif (code < 0 && errno == ENOENT)\n+\t\tdie(\"Unable to find remote helper for '%s'\", data->name);\n+\telse if (code != 0)\n+\t\texit(code);\n+\n \tdata->helper = helper;\n \tdata->no_disconnect_req = 0;\n \n-- \n1.6.6.115.gd1ab3\n"},{"id":"131429","messageId":"7v1vhutrwf.fsf@alter.siamese.dyndns.org","threadId":"22185","inReplyTo":"201001122053.29568.j6t@kdbg.org","subject":"Re: [BUGFIX] Unbork remote helper execution","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-13T06:56:00Z","receivedAt":"2010-01-13T06:56:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks, both of you.\n"}]}