Skip to content

Commit bc0c0d8

Browse files
dschogitster
authored andcommitted
clone: respect url.insteadOf setting in global configs
When we call "git clone" with a url that has a rewrite rule in either $HOME/.gitconfig or /etc/gitconfig, the URL can be different from what the command line expects it to be. So, let's use the URL as the remote structure has it, not the literal string from the command line. Noticed by Pieter de Bie. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Acked-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7ac749c commit bc0c0d8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builtin-clone.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
452452
refs = clone_local(path, git_dir);
453453
else {
454454
struct remote *remote = remote_get(argv[0]);
455-
struct transport *transport = transport_get(remote, argv[0]);
455+
struct transport *transport =
456+
transport_get(remote, remote->url[0]);
456457

457458
if (!transport->get_refs_list || !transport->fetch)
458459
die("Don't know how to clone %s", transport->url);

0 commit comments

Comments
 (0)