@matheusbsbs / matheus-bagliano / commits / 4da504608e
Fork 0

Fix remote.<remote>.vcs

remote.<remote>.vcs causes remote->foreign_vcs to be set on entry to transport_get(). Unfortunately, the code assumed that any such entry is stale from previous round. Fix this by making VCS set by URL to be volatile w.r.t. transport_get() instead. Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Acked-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ilari Liusvaara committed Jan 27, 2010 at 19:53 UTC 4da504608ea94fbcac65eb287d8d5791bddefd88
1 file changed +5 -6
transport.c
+5 -6
@@ -912,20 +912,19 @@ static int external_specification_len(const char *url)
912
913 struct transport *transport_get(struct remote *remote, const char *url)
914 {
915 + const char *helper;
916 struct transport *ret = xcalloc(1, sizeof(*ret));
917
918 if (!remote)
919 die("No remote provided to transport_get()");
920
921 ret->remote = remote;
922 + helper = remote->foreign_vcs;
923
924 if (!url && remote && remote->url)
925 url = remote->url[0];
926 ret->url = url;
927
926 - /* In case previous URL had helper forced, reset it. */
927 - remote->foreign_vcs = NULL;
928 -
928 /* maybe it is a foreign URL? */
929 if (url) {
930 const char *p = url;
@@ -933,11 +932,11 @@ struct transport *transport_get(struct remote *remote, const char *url)
932 while (isalnum(*p))
933 p++;
934 if (!prefixcmp(p, "::"))
936 - remote->foreign_vcs = xstrndup(url, p - url);
935 + helper = xstrndup(url, p - url);
936 }
937
939 - if (remote && remote->foreign_vcs) {
940 - transport_helper_init(ret, remote->foreign_vcs);
938 + if (helper) {
939 + transport_helper_init(ret, helper);
940 } else if (!prefixcmp(url, "rsync:")) {
941 ret->get_refs_list = get_refs_via_rsync;
942 ret->fetch = fetch_objs_via_rsync;