diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-10-03 13:30:34 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-03 13:30:35 -0700 |
commit | 53eb85e6230e2c09dbc06f88b67e7a3baccc4446 (patch) | |
tree | 6290667f96d15d82b964e5f9ed9db906e8fca616 /builtin/clone.c | |
parent | 347408496a08f18b49b3646b6bb20d17cce85632 (diff) | |
parent | 822d9406c0b397bac7cfc4fda7b355aa1dd2cc52 (diff) | |
download | git-53eb85e6230e2c09dbc06f88b67e7a3baccc4446.tar.gz |
Merge branch 'nd/init-core-worktree-in-multi-worktree-world'
"git init" tried to record core.worktree in the repository's
'config' file when GIT_WORK_TREE environment variable was set and
it was different from where GIT_DIR appears as ".git" at its top,
but the logic was faulty when .git is a "gitdir:" file that points
at the real place, causing trouble in working trees that are
managed by "git worktree". This has been corrected.
* nd/init-core-worktree-in-multi-worktree-world:
init: kill git_link variable
init: do not set unnecessary core.worktree
init: kill set_git_dir_init()
init: call set_git_dir_init() from within init_db()
init: correct re-initialization from a linked worktree
Diffstat (limited to 'builtin/clone.c')
-rw-r--r-- | builtin/clone.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index 28ce9383a1..fb75f7ee64 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -935,16 +935,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix) set_git_work_tree(work_tree); } - junk_git_dir = git_dir; + junk_git_dir = real_git_dir ? real_git_dir : git_dir; if (safe_create_leading_directories_const(git_dir) < 0) die(_("could not create leading directories of '%s'"), git_dir); - set_git_dir_init(git_dir, real_git_dir, 0); - if (real_git_dir) { - git_dir = real_git_dir; - junk_git_dir = real_git_dir; - } - if (0 <= option_verbosity) { if (option_bare) fprintf(stderr, _("Cloning into bare repository '%s'...\n"), dir); @@ -970,7 +964,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix) } } - init_db(option_template, INIT_DB_QUIET); + init_db(git_dir, real_git_dir, option_template, INIT_DB_QUIET); + + if (real_git_dir) + git_dir = real_git_dir; + write_config(&option_config); git_config(git_default_config, NULL); |