Skip to content

Commit c578f51

Browse files
iabervongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Sverre Rabbelier <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3714831 commit c578f51

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

Documentation/config.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,10 @@ remote.<name>.tagopt::
14081408
Setting this value to \--no-tags disables automatic tag following when
14091409
fetching from remote <name>
14101410

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+
14111415
remotes.<group>::
14121416
The list of remotes which are fetched by "git remote update
14131417
<group>". See linkgit:git-remote[1].

remote.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static char buffer[BUF_SIZE];
5454

5555
static int valid_remote(const struct remote *remote)
5656
{
57-
return !!remote->url;
57+
return (!!remote->url) || (!!remote->foreign_vcs);
5858
}
5959

6060
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)
444444
} else if (!strcmp(subkey, ".proxy")) {
445445
return git_config_string((const char **)&remote->http_proxy,
446446
key, value);
447+
} else if (!strcmp(subkey, ".vcs")) {
448+
return git_config_string(&remote->foreign_vcs, key, value);
447449
}
448450
return 0;
449451
}

remote.h

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ struct remote {
1111
const char *name;
1212
int origin;
1313

14+
const char *foreign_vcs;
15+
1416
const char **url;
1517
int url_nr;
1618
int url_alloc;

transport.c

+5
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,11 @@ struct transport *transport_get(struct remote *remote, const char *url)
818818
url = remote->url[0];
819819
ret->url = url;
820820

821+
if (remote && remote->foreign_vcs) {
822+
transport_helper_init(ret, remote->foreign_vcs);
823+
return ret;
824+
}
825+
821826
if (!prefixcmp(url, "rsync:")) {
822827
ret->get_refs_list = get_refs_via_rsync;
823828
ret->fetch = fetch_objs_via_rsync;

0 commit comments

Comments
 (0)