diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-09-25 10:14:39 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-25 16:32:35 -0700 |
commit | 6311cfaf93716bcc43dd1151cb1763e3f80d8099 (patch) | |
tree | 70e5c6f6a1f580a0fd837e7a4a0d5645300102f3 /builtin/add.c | |
parent | init: kill set_git_dir_init() (diff) | |
download | tgif-6311cfaf93716bcc43dd1151cb1763e3f80d8099.tar.xz |
init: do not set unnecessary core.worktree
The function needs_work_tree_config() that is called from
create_default_files() is supposed to be fed the path to ".git" that
looks as if it is at the top of the working tree, and decide if that
location matches the actual worktree being used. This comparison allows
"git init" to decide if core.worktree needs to be recorded in the
working tree.
In the current code, however, we feed the return value from
get_git_dir(), which can be totally different from what the function
expects when "gitdir" file is involved. Instead of giving the path to
the ".git" at the top of the working tree, we end up feeding the actual
path that the file points at.
This original location of ".git" however is only known to init_db().
Make init_db() save it and have it passed to create_default_files() as a
new parameter, which passes the correct location down to
needs_work_tree_config() to fix this.
Noticed-by: Max Nordlund <max.nordlund@sqore.com>
Helped-by: Michael J Gruber <git@drmicha.warpmail.net>
Helped-by: Junio C Hamano <gitster@pobox.com>
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/add.c')
0 files changed, 0 insertions, 0 deletions