summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorThomas Quinot <thomas@quinot.org>2014-11-09 22:42:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-11-10 16:55:10 (GMT)
commit39942766ab9bc738f49f93d4c8ea68ffbaadc305 (patch)
treedf0269061d591a451060a9f6587763e451b25627 /connect.c
parent66edfe9ddc29102fa39edd37f9aecccbaca6a013 (diff)
downloadgit-39942766ab9bc738f49f93d4c8ea68ffbaadc305.zip
git-39942766ab9bc738f49f93d4c8ea68ffbaadc305.tar.gz
git-39942766ab9bc738f49f93d4c8ea68ffbaadc305.tar.bz2
git_connect: set ssh shell command in GIT_SSH_COMMAND
It may be impractical to install a wrapper script for GIT_SSH when additional parameters need to be passed. Provide an alternative way of specifying a shell command to be run, including command line arguments, by means of the GIT_SSH_COMMAND environment variable, which behaves like GIT_SSH but is passed to the shell. The special circuitry to modify parameters in the case of using PuTTY's plink/tortoiseplink is activated only when using GIT_SSH; in the case of using GIT_SSH_COMMAND, it is deliberately left up to the user to make any required parameters adaptation before calling the underlying ssh implementation. Signed-off-by: Thomas Quinot <thomas@quinot.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/connect.c b/connect.c
index d47d0ec..cb23bbc 100644
--- a/connect.c
+++ b/connect.c
@@ -700,14 +700,23 @@ struct child_process *git_connect(int fd[2], const char *url,
conn->in = conn->out = -1;
if (protocol == PROTO_SSH) {
- const char *ssh = getenv("GIT_SSH");
- int putty = ssh && strcasestr(ssh, "plink");
+ const char *ssh;
+ int putty;
char *ssh_host = hostandport;
const char *port = NULL;
get_host_and_port(&ssh_host, &port);
port = get_port_numeric(port);
- if (!ssh) ssh = "ssh";
+ ssh = getenv("GIT_SSH_COMMAND");
+ if (ssh) {
+ conn->use_shell = 1;
+ putty = 0;
+ } else {
+ ssh = getenv("GIT_SSH");
+ if (!ssh)
+ ssh = "ssh";
+ putty = !!strcasestr(ssh, "plink");
+ }
argv_array_push(&conn->args, ssh);
if (putty && !strcasestr(ssh, "tortoiseplink"))