[PATCH 5/7] Add a config option for remotes to specify a foreign vcs
From: Daniel Barkalow <hidden>
Date: 2016-06-15 22:46:51
Subsystem:
documentation, the rest · Maintainers:
Jonathan Corbet, Linus Torvalds
This can be used instead of a url in a valid remote configuration, but the resulting transport cannot do anything. Signed-off-by: Daniel Barkalow <redacted> --- Documentation/config.txt | 4 ++++ remote.c | 4 +++- remote.h | 2 ++ transport.c | 4 ++++ 4 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 2c03162..d6c6c9c 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt@@ -1347,6 +1347,10 @@ remote.<name>.tagopt:: Setting this value to \--no-tags disables automatic tag following when fetching from remote <name> +remote.<name>.vcs:: + Setting this to a value <vcs> will cause git to interact with + the remote with the git-vcs-<vcs> helper. + remotes.<group>:: The list of remotes which are fetched by "git remote update <group>". See linkgit:git-remote[1].
diff --git a/remote.c b/remote.c
index 5552ce7..168b0ce 100644
--- a/remote.c
+++ b/remote.c@@ -50,7 +50,7 @@ static char buffer[BUF_SIZE]; static int valid_remote(const struct remote *remote) { - return !!remote->url; + return remote->url || remote->foreign_vcs; } static const char *alias_url(const char *url)
@@ -416,6 +416,8 @@ static int handle_config(const char *key, const char *value, void *cb) } else if (!strcmp(subkey, ".proxy")) { return git_config_string((const char **)&remote->http_proxy, key, value); + } else if (!strcmp(subkey, ".vcs")) { + return git_config_string(&remote->foreign_vcs, key, value); } return 0; }
diff --git a/remote.h b/remote.h
index 99706a8..a234b37 100644
--- a/remote.h
+++ b/remote.h@@ -11,6 +11,8 @@ struct remote { const char *name; int origin; + const char *foreign_vcs; + const char **url; int url_nr; int url_alloc;
diff --git a/transport.c b/transport.c
index b9f1f6e..011a8dc 100644
--- a/transport.c
+++ b/transport.c@@ -938,6 +938,10 @@ struct transport *transport_get(struct remote *remote, const char *url) ret->remote = remote; + if (remote && remote->foreign_vcs) { + return ret; + } + if (!url && remote) url = remote->url[0]; ret->url = url;
--
1.6.0.6