Re: [PATCH v3 06/10] clone: delay cloning until after remote HEAD checking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Junio C Hamano <gitster@xxxxxxxxx> writes:
>
>> It breaks pushing to multiple URLs like this:
>>
>>     $ cat .git/config
>>     [remote "origin"]
>>             url = https://code.google.com/p/git-htmldocs/
>>             url = github.com:gitster/git-htmldocs.git
>>             push = refs/heads/master:refs/heads/master
>>     $ git push
>>
>> The second url that is supposed to use the git-over-ssh transport
>> mistakenly use https:// and fails with:
>>
>>     error: Couldn't resolve host 'github.com:gitster' while accessing
>>     github.com:gitster/git-htmldocs.git/info/refs
>>     fatal: HTTP request failed
>
> And here is an obvious band-aid to work it around.

-- >8 --
Subject: [PATCH] push: do not let configured foreign-vcs permanently clobbered

Recently, 6f48d39 (clone: delay cloning until after remote HEAD checking,
2012-01-16) tried to record if a remote helper needs to be called after
parsing the remote when transport_get() is called, by overwriting the
field meant to store the configured remote helper name in the remote
structure.

This is OK when a remote represents a single remote repository, but fails
miserably when pushing to locations with multiple URLs, like this:

    $ cat .git/config
    [remote "origin"]
        url = https://code.google.com/p/git-htmldocs/
        url = github.com:gitster/git-htmldocs.git
        push = refs/heads/master:refs/heads/master
    $ git push

The second url that is supposed to use the git-over-ssh transport
mistakenly use https:// and fails with:

    error: Couldn't resolve host 'github.com:gitster' while accessing
    github.com:gitster/git-htmldocs.git/info/refs
    fatal: HTTP request failed

The right solution would probably be to dedicate a separate field to store
the detected external helper to be used, which is valid only during a
single use of transport until it is disconnected, instead of overwriting
foreign_vcs field, but in the meantime, this band-aid should suffice.

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 builtin/push.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/builtin/push.c b/builtin/push.c
index 35cce53..5fb98a0 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -204,11 +204,13 @@ static int do_push(const char *repo, int flags)
 		url_nr = remote->url_nr;
 	}
 	if (url_nr) {
+		const char *configured_foreign_vcs = remote->foreign_vcs;
 		for (i = 0; i < url_nr; i++) {
 			struct transport *transport =
 				transport_get(remote, url[i]);
 			if (push_with_options(transport, flags))
 				errs++;
+			remote->foreign_vcs = configured_foreign_vcs;
 		}
 	} else {
 		struct transport *transport =
-- 
1.7.9.rc2.100.gfd863d

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]