git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUGFIX] Unbork remote helper execution

From
Johannes Sixt <j6t@kdbg.org>
Date
Jan 12, 2010, 19:53 UTC
Message-ID
<201001122053.29568.j6t@kdbg.org>
In-Reply-To
<1263321344-21237-1-git-send-email-ilari.liusvaara@elisanet.fi>
[added git@vger]
On Dienstag, 12. Januar 2010, Ilari Liusvaara wrote:
Show 10 quoted lines
> Someone that obiviously didn't test the change did the following (the
> code blames to me, but I didn't write this):
>
> code = start_command(helper);
> if (code < 0 && errno == ENOENT)
> 	die("Unable to find remote helper for '%s'", data->name);
> else
> 	exit(code);
>
> Which is obiviously wrong. The code shouldn't exit if code is 0.
Duh! Sorry for that. Your original code indeed has 'else if (code != 0)'.

Thanks for catching this. BTW, the test suite passes nevertheless. Aren't there any tests that exercise the code path, or do I have them disabled somehow? So, yes: I didn't test the change.

Here is the amended commit that replaces the tip of js/exec-error-report,
with some light testing this time.
--- 8< ---
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Subject: [PATCH] Improve error message when a transport helper was not found
Perviously, the error message was:
    git: 'remote-foo' is not a git-command. See 'git --help'.

By not treating the transport helper as a git command, a more suitable error is reported:

    fatal: Unable to find remote helper for 'foo'
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 transport-helper.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/transport-helper.c b/transport-helper.c
index 6ece0d9..7dce4a4 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -102,6 +102,7 @@ static struct child_process *get_helper(struct transport *transport)
 	int refspec_nr = 0;
 	int refspec_alloc = 0;
 	int duped;
+	int code;
 
 	if (data->helper)
 		return data->helper;
@@ -111,13 +112,18 @@ static struct child_process *get_helper(struct transport *transport)
 	helper->out = -1;
 	helper->err = 0;
 	helper->argv = xcalloc(4, sizeof(*helper->argv));
-	strbuf_addf(&buf, "remote-%s", data->name);
+	strbuf_addf(&buf, "git-remote-%s", data->name);
 	helper->argv[0] = strbuf_detach(&buf, NULL);
 	helper->argv[1] = transport->remote->name;
 	helper->argv[2] = remove_ext_force(transport->url);
-	helper->git_cmd = 1;
-	if (start_command(helper))
-		die("Unable to run helper: git %s", helper->argv[0]);
+	helper->git_cmd = 0;
+	helper->silent_exec_failure = 1;
+	code = start_command(helper);
+	if (code < 0 && errno == ENOENT)
+		die("Unable to find remote helper for '%s'", data->name);
+	else if (code != 0)
+		exit(code);
+
 	data->helper = helper;
 	data->no_disconnect_req = 0;
 
-- 
1.6.6.115.gd1ab3
Next: Junio C Hamano
Message 1 of 2 in “Re: [BUGFIX] Unbork remote helper execution”
  1. Johannes SixtJan 12, 2010
  2. Junio C HamanoJan 13, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.