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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ilari Liusvaara committed
Jan 12, 2010 at 20:53 UTC
6b02de3b9dc4ac8374cea4964e993ec6636d781c
1 file changed
+10
-4
transport-helper.c
+10
-4
@@ -102,6 +102,7 @@ static struct child_process *get_helper(struct transport *transport)
102
int refspec_nr = 0;
103
int refspec_alloc = 0;
104
int duped;
105
+ int code;
106
107
if (data->helper)
108
return data->helper;
@@ -111,13 +112,18 @@ static struct child_process *get_helper(struct transport *transport)
112
helper->out = -1;
113
helper->err = 0;
114
helper->argv = xcalloc(4, sizeof(*helper->argv));
114
- strbuf_addf(&buf, "remote-%s", data->name);
115
+ strbuf_addf(&buf, "git-remote-%s", data->name);
116
helper->argv[0] = strbuf_detach(&buf, NULL);
117
helper->argv[1] = transport->remote->name;
118
helper->argv[2] = remove_ext_force(transport->url);
118
- helper->git_cmd = 1;
119
- if (start_command(helper))
120
- die("Unable to run helper: git %s", helper->argv[0]);
119
+ helper->git_cmd = 0;
120
+ helper->silent_exec_failure = 1;
121
+ code = start_command(helper);
122
+ if (code < 0 && errno == ENOENT)
123
+ die("Unable to find remote helper for '%s'", data->name);
124
+ else if (code != 0)
125
+ exit(code);
126
+
127
data->helper = helper;
128
data->no_disconnect_req = 0;
129