@matheusbsbs / matheus-bagliano / commits / c578f51d52
Fork 0

Add a config option for remotes to specify a foreign vcs

If this is set, the url is not required, and the transport always uses a helper named "git-remote-<value>". It is a separate configuration option in order to allow a sensible configuration for foreign systems which either have no meaningful urls for repositories or which require urls that do not specify the system used by the repository at that location. However, this only affects how the name of the helper is determined, not anything about the interaction with the helper, and the contruction is such that, if the foreign scm does happen to use a co-named url method, a url with that method may be used directly. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Daniel Barkalow committed Nov 18, 2009 at 02:42 UTC c578f51d52fe75e71d75566c2c216af989b65e6e
4 files changed +14 -1
Documentation/config.txt
+4
@@ -1408,6 +1408,10 @@ remote.<name>.tagopt::
1408 Setting this value to \--no-tags disables automatic tag following when
1409 fetching from remote <name>
1410
1411 +remote.<name>.vcs::
1412 + Setting this to a value <vcs> will cause git to interact with
1413 + the remote with the git-remote-<vcs> helper.
1414 +
1415 remotes.<group>::
1416 The list of remotes which are fetched by "git remote update
1417 <group>". See linkgit:git-remote[1].
remote.c
+3 -1
@@ -54,7 +54,7 @@ static char buffer[BUF_SIZE];
54
55 static int valid_remote(const struct remote *remote)
56 {
57 - return !!remote->url;
57 + return (!!remote->url) || (!!remote->foreign_vcs);
58 }
59
60 static const char *alias_url(const char *url, struct rewrites *r)
@@ -444,6 +444,8 @@ static int handle_config(const char *key, const char *value, void *cb)
444 } else if (!strcmp(subkey, ".proxy")) {
445 return git_config_string((const char **)&remote->http_proxy,
446 key, value);
447 + } else if (!strcmp(subkey, ".vcs")) {
448 + return git_config_string(&remote->foreign_vcs, key, value);
449 }
450 return 0;
451 }
remote.h
+2
@@ -11,6 +11,8 @@ struct remote {
11 const char *name;
12 int origin;
13
14 + const char *foreign_vcs;
15 +
16 const char **url;
17 int url_nr;
18 int url_alloc;
transport.c
+5
@@ -818,6 +818,11 @@ struct transport *transport_get(struct remote *remote, const char *url)
818 url = remote->url[0];
819 ret->url = url;
820
821 + if (remote && remote->foreign_vcs) {
822 + transport_helper_init(ret, remote->foreign_vcs);
823 + return ret;
824 + }
825 +
826 if (!prefixcmp(url, "rsync:")) {
827 ret->get_refs_list = get_refs_via_rsync;
828 ret->fetch = fetch_objs_via_rsync;