From bc0c0d81561bdbb8cb5e1f3af558390f1a0c86cb Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 27 Jun 2008 13:56:05 +0100 Subject: 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 Acked-by: Daniel Barkalow Signed-off-by: Junio C Hamano --- builtin-clone.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin-clone.c') diff --git a/builtin-clone.c b/builtin-clone.c index b2dfe1ab5..9c028e76a 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -452,7 +452,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix) refs = clone_local(path, git_dir); else { struct remote *remote = remote_get(argv[0]); - struct transport *transport = transport_get(remote, argv[0]); + struct transport *transport = + transport_get(remote, remote->url[0]); if (!transport->get_refs_list || !transport->fetch) die("Don't know how to clone %s", transport->url); -- cgit v1.2.1 From 5b8063b5b0f56f0da345e8dd7c66d3aced1af673 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 27 Jun 2008 13:55:23 +0100 Subject: clone: respect the settings in $HOME/.gitconfig and /etc/gitconfig After initializing the config in the newly-created repository, we need to unset GIT_CONFIG so that the global configs are read again. Noticed by Pieter de Bie. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- builtin-clone.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'builtin-clone.c') diff --git a/builtin-clone.c b/builtin-clone.c index 9c028e76a..e9ecb5d21 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -420,6 +420,13 @@ int cmd_clone(int argc, const char **argv, const char *prefix) fprintf(stderr, "Initialize %s\n", git_dir); init_db(option_template, option_quiet ? INIT_DB_QUIET : 0); + /* + * At this point, the config exists, so we do not need the + * environment variable. We actually need to unset it, too, to + * re-enable parsing of the global configs. + */ + unsetenv(CONFIG_ENVIRONMENT); + if (option_reference) setup_reference(git_dir); -- cgit v1.2.1