Skip to content

Commit dad0b3d

Browse files
committed
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2857093 commit dad0b3d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin/push.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,13 @@ static int do_push(const char *repo, int flags)
204204
url_nr = remote->url_nr;
205205
}
206206
if (url_nr) {
207+
const char *configured_foreign_vcs = remote->foreign_vcs;
207208
for (i = 0; i < url_nr; i++) {
208209
struct transport *transport =
209210
transport_get(remote, url[i]);
210211
if (push_with_options(transport, flags))
211212
errs++;
213+
remote->foreign_vcs = configured_foreign_vcs;
212214
}
213215
} else {
214216
struct transport *transport =

0 commit comments

Comments
 (0)