diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-09-25 10:14:37 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-25 16:32:35 -0700 |
commit | 33158701e2cac4244a236cd18d9d336f66e535f3 (patch) | |
tree | fbb5ae9663797e8c3b74afc59801d65e053753f6 /builtin/clone.c | |
parent | init: correct re-initialization from a linked worktree (diff) | |
download | tgif-33158701e2cac4244a236cd18d9d336f66e535f3.tar.xz |
init: call set_git_dir_init() from within init_db()
The next commit requires that set_git_dir_init() must be called before
init_db(). Let's make sure nobody can do otherwise.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/clone.c')
-rw-r--r-- | builtin/clone.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index 661639255c..29b18329ee 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -928,23 +928,22 @@ 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); else fprintf(stderr, _("Cloning into '%s'...\n"), dir); } - 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); |