summaryrefslogtreecommitdiff
path: root/t/t1509/prepare-chroot.sh
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2015-05-29 02:49:10 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-05-29 09:27:27 -0700
commitfada767463b599951b37bd544379a1d18dcf9370 (patch)
tree353d76e13430b30da916a60bab2ce749f682fd4c /t/t1509/prepare-chroot.sh
parentGit 2.2.2 (diff)
downloadtgif-fada767463b599951b37bd544379a1d18dcf9370.tar.xz
setup_git_directory: delay core.bare/core.worktree errors
If both core.bare and core.worktree are set, we complain about the bogus config and die. Dying is good, because it avoids commands running and doing damage in a potentially incorrect setup. But dying _there_ is bad, because it means that commands which do not even care about the work tree cannot run. This can make repairing the situation harder: [setup] $ git config core.bare true $ git config core.worktree /some/path [OK, expected.] $ git status fatal: core.bare and core.worktree do not make sense [Hrm...] $ git config --unset core.worktree fatal: core.bare and core.worktree do not make sense [Nope...] $ git config --edit fatal: core.bare and core.worktree do not make sense [Gaaah.] $ git help config fatal: core.bare and core.worktree do not make sense Instead, let's issue a warning about the bogus config when we notice it (i.e., for all commands), but only die when the command tries to use the work tree (by calling setup_work_tree). So we now get: $ git status warning: core.bare and core.worktree do not make sense fatal: unable to set up work tree using invalid config $ git config --unset core.worktree warning: core.bare and core.worktree do not make sense We have to update t1510 to accomodate this; it uses symbolic-ref to check whether the configuration works or not, but of course that command does not use the working tree. Instead, we switch it to use `git status`, as it requires a work-tree, does not need any special setup, and is read-only (so a failure will not adversely affect further tests). In addition, we add a new test that checks the desired behavior (i.e., that running "git config" with the bogus config does in fact work). Reported-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1509/prepare-chroot.sh')
0 files changed, 0 insertions, 0 deletions