diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-09-25 10:14:36 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-25 16:32:35 -0700 |
commit | fe9aa0b22e18e5cd1ae4a9323edad0d3c8177c90 (patch) | |
tree | 8684d5c1993e6dc8d8312bb8a782b2feacfd878b /t/t3800-mktag.sh | |
parent | t1007: factor out repeated setup (diff) | |
download | tgif-fe9aa0b22e18e5cd1ae4a9323edad0d3c8177c90.tar.xz |
init: correct re-initialization from a linked worktree
When 'git init' is called from a linked worktree, we treat '.git'
dir (which is $GIT_COMMON_DIR/worktrees/something) as the main
'.git' (i.e. $GIT_COMMON_DIR) and populate the whole repository skeleton
in there. It does not harm anything (*) but it is still wrong.
Since 'git init' calls set_git_dir() at preparation time, which
indirectly calls get_common_dir() and correctly detects multiple
worktree setup, all git_path_buf() calls in create_default_files() will
return correct paths in both single and multiple worktree setups. The
only thing left is copy_templates(), which targets $GIT_DIR, not
$GIT_COMMON_DIR.
Fix that with get_git_common_dir(). This function will return $GIT_DIR
in single-worktree setup, so we don't have to make a special case for
multiple-worktree here.
(*) It does in fact, thanks to another bug. More on that later.
Noticed-by: Max Nordlund <max.nordlund@sqore.com>
Helped-by: Michael J Gruber <git@drmicha.warpmail.net>
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 't/t3800-mktag.sh')
0 files changed, 0 insertions, 0 deletions