summaryrefslogtreecommitdiff
path: root/t/t7605-merge-resolve.sh
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2015-04-02 14:37:40 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-04-02 12:29:15 -0700
commit84ccad8dec1b8675699d70412def098d61456c55 (patch)
tree0be73fae8b41992942fca51fd30825d883944ba3 /t/t7605-merge-resolve.sh
parentMerge branch 'maint-1.9' into maint-2.0 (diff)
downloadtgif-84ccad8dec1b8675699d70412def098d61456c55.tar.xz
init: don't set core.worktree when initializing /.git
If you create a git repository in the root directory with "git init /", we erroneously write a core.worktree entry. This isn't _wrong_, in the sense that it's OK to set core.worktree when we don't need to. But it is unnecessarily surprising if you later move the .git directory to another path (which usually moves the relative working tree, but is foiled if there is an explicit worktree set). The problem is that we check whether core.worktree is necessary by seeing if we can make the git_dir by concatenating "/.git" onto the working tree. That would lead to "//.git" in this instance, but we actually have "/.git" (without the doubled slash). We can fix this by special-casing the root directory. I also split the logic out into its own function to make the conditional a bit more readable (and used skip_prefix, which I think makes it a little more obvious what is going on). No tests, as we would need to be able to write to "/" to do so. I did manually confirm that: sudo git init / cd / git rev-parse --show-toplevel git config core.worktree still finds the top-level correctly (as "/"), and does not set any core.worktree variable. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7605-merge-resolve.sh')
0 files changed, 0 insertions, 0 deletions