summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87b3c01)
raw | patch | inline | side by side (parent: 87b3c01)
author | Sverre Rabbelier <srabbelier@gmail.com> | |
Mon, 29 Mar 2010 16:48:23 +0000 (11:48 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 31 Mar 2010 16:37:26 +0000 (09:37 -0700) |
Currently when using a remote helper to clone a repository, the
remote helper will be passed the url of the target repository as
first argument (which represents the name of the remote). This name
is extracted from transport->remote->name, which is set by
builtin/clone.c when it calls remote_get with argv[0] as argument.
Fix this by passing the name remote will be set up as instead.
However, setup_reference calls remote_get before the remote is
added to the config file. This will result in an improperly
configured remote (in memory) if later on remote_get is called
with an argument that is not equal to the initial remote_get call
in setup_reference. Fix this by delaying the remote_get call until
after the remote has been added to the config file.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote helper will be passed the url of the target repository as
first argument (which represents the name of the remote). This name
is extracted from transport->remote->name, which is set by
builtin/clone.c when it calls remote_get with argv[0] as argument.
Fix this by passing the name remote will be set up as instead.
However, setup_reference calls remote_get before the remote is
added to the config file. This will result in an improperly
configured remote (in memory) if later on remote_get is called
with an argument that is not equal to the initial remote_get call
in setup_reference. Fix this by delaying the remote_get call until
after the remote has been added to the config file.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c | patch | blob | history |
diff --git a/builtin/clone.c b/builtin/clone.c
index 05f8fb4771b1ef07030338a6fd38dc7cb3bc1d1d..068d61fd33a00ec867d3e526c1f44ae3a3b3aa43 100644 (file)
--- a/builtin/clone.c
+++ b/builtin/clone.c
*/
unsetenv(CONFIG_ENVIRONMENT);
- if (option_reference)
- setup_reference(git_dir);
-
git_config(git_default_config, NULL);
if (option_bare) {
strbuf_reset(&key);
}
+ if (option_reference)
+ setup_reference(git_dir);
+
fetch_pattern = value.buf;
refspec = parse_fetch_refspec(1, &fetch_pattern);
refs = clone_local(path, git_dir);
mapped_refs = wanted_peer_refs(refs, refspec);
} else {
- struct remote *remote = remote_get(argv[0]);
+ struct remote *remote = remote_get(option_origin);
transport = transport_get(remote, remote->url[0]);
if (!transport->get_refs_list || !transport->fetch)