summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-12-05 11:39:25 -0800
committerJunio C Hamano <gitster@pobox.com>2014-12-05 11:39:25 -0800
commit09d60d785c68c8fa65094ecbe46fbc2a38d0fc1f (patch)
tree44228a921720d7aaf07e214360003a0998ea64bc /connect.c
parent05d7fb6290dbe07831529746192f7006483632e4 (diff)
parent39942766ab9bc738f49f93d4c8ea68ffbaadc305 (diff)
downloadgit-09d60d785c68c8fa65094ecbe46fbc2a38d0fc1f.tar.gz
Merge branch 'tq/git-ssh-command'
Allow passing extra set of arguments when ssh is invoked to create an encrypted & authenticated connection by introducing a new environment variable GIT_SSH_COMMAND, whose contents is interpreted by shells. This is not possible with existing GIT_SSH mechanism whose invocation bypasses shells, which was designed more to match what other programs with similar variables did, not necessarily to be more useful. * tq/git-ssh-command: git_connect: set ssh shell command in GIT_SSH_COMMAND
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 d47d0ec604..cb23bbcf22 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"))