From 5a767ce9644b12e2eab5ef928ebb9673f36fcff8 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 13 Jan 2018 00:00:50 +0100 Subject: Support non-https:// repositories for saving On saving to a remote git repository, the transport was set to https://, which broke saving to ssh:// repositories. Instead determine the transport from the remote url. Signed-off-by: Berthold Stoeger --- core/git-access.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'core/git-access.c') diff --git a/core/git-access.c b/core/git-access.c index bb5acbec6..ac8778f73 100644 --- a/core/git-access.c +++ b/core/git-access.c @@ -766,18 +766,21 @@ static git_repository *create_local_repo(const char *localdir, const char *remot return cloned_repo; } -static struct git_repository *get_remote_repo(const char *localdir, const char *remote, const char *branch) +enum remote_transport url_to_remote_transport(const char *remote) { - struct stat st; - enum remote_transport rt; - /* figure out the remote transport */ if (strncmp(remote, "ssh://", 6) == 0) - rt = RT_SSH; + return RT_SSH; else if (strncmp(remote, "https://", 8) == 0) - rt = RT_HTTPS; + return RT_HTTPS; else - rt = RT_OTHER; + return RT_OTHER; +} + +static struct git_repository *get_remote_repo(const char *localdir, const char *remote, const char *branch) +{ + struct stat st; + enum remote_transport rt = url_to_remote_transport(remote); if (verbose > 1) { fprintf(stderr, "git_remote_repo: accessing %s\n", remote); -- cgit v1.2.3-70-g09d2