Skip to content

Commit 182c5af

Browse files
committed
Merge branch 'js/maint-clone-insteadof' into maint
* js/maint-clone-insteadof: clone: respect the settings in $HOME/.gitconfig and /etc/gitconfig clone: respect url.insteadOf setting in global configs
2 parents 1f42b8e + 5b8063b commit 182c5af

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

builtin-clone.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,13 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
420420
fprintf(stderr, "Initialize %s\n", git_dir);
421421
init_db(option_template, option_quiet ? INIT_DB_QUIET : 0);
422422

423+
/*
424+
* At this point, the config exists, so we do not need the
425+
* environment variable. We actually need to unset it, too, to
426+
* re-enable parsing of the global configs.
427+
*/
428+
unsetenv(CONFIG_ENVIRONMENT);
429+
423430
if (option_reference)
424431
setup_reference(git_dir);
425432

@@ -452,7 +459,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
452459
refs = clone_local(path, git_dir);
453460
else {
454461
struct remote *remote = remote_get(argv[0]);
455-
struct transport *transport = transport_get(remote, argv[0]);
462+
struct transport *transport =
463+
transport_get(remote, remote->url[0]);
456464

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

0 commit comments

Comments
 (0)