summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-07-19 20:22:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-07-19 20:22:12 (GMT)
commitdc21164e66e39670931d3270f8db4c0ed0e0b816 (patch)
treedb152f8f0a5c43972972a7b298f8fa932544dfa1
parent29493589e97a2de0c4c1c314f61ccafaee3b5caf (diff)
parent3c8ede3ff312134e84d1b23a309cd7d2a7c98e9c (diff)
downloadgit-dc21164e66e39670931d3270f8db4c0ed0e0b816.zip
git-dc21164e66e39670931d3270f8db4c0ed0e0b816.tar.gz
git-dc21164e66e39670931d3270f8db4c0ed0e0b816.tar.bz2
Merge branch 'nd/connect-ssh-command-config'
A new configuration variable core.sshCommand has been added to specify what value for GIT_SSH_COMMAND to use per repository. * nd/connect-ssh-command-config: connect: read $GIT_SSH_COMMAND from config file
-rw-r--r--Documentation/config.txt7
-rw-r--r--connect.c15
2 files changed, 21 insertions, 1 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 16dc22d..226c12a 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -450,6 +450,13 @@ specify that no proxy be used for a given domain pattern.
This is useful for excluding servers inside a firewall from
proxy use, while defaulting to a common proxy for external domains.
+core.sshCommand::
+ If this variable is set, `git fetch` and `git push` will
+ use the specified command instead of `ssh` when they need to
+ connect to a remote system. The command is in the same form as
+ the `GIT_SSH_COMMAND` environment variable and is overridden
+ when the environment variable is set.
+
core.ignoreStat::
If true, Git will avoid using lstat() calls to detect if files have
changed by setting the "assume-unchanged" bit for those tracked files
diff --git a/connect.c b/connect.c
index c53f3f1..722dc3f 100644
--- a/connect.c
+++ b/connect.c
@@ -658,6 +658,19 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
static struct child_process no_fork = CHILD_PROCESS_INIT;
+static const char *get_ssh_command(void)
+{
+ const char *ssh;
+
+ if ((ssh = getenv("GIT_SSH_COMMAND")))
+ return ssh;
+
+ if (!git_config_get_string_const("core.sshcommand", &ssh))
+ return ssh;
+
+ return NULL;
+}
+
/*
* This returns a dummy child_process if the transport protocol does not
* need fork(2), or a struct child_process object if it does. Once done,
@@ -758,7 +771,7 @@ struct child_process *git_connect(int fd[2], const char *url,
return NULL;
}
- ssh = getenv("GIT_SSH_COMMAND");
+ ssh = get_ssh_command();
if (!ssh) {
const char *base;
char *ssh_dup;