Skip to content

Commit 7790b8c

Browse files
sunshinecogitster
authored andcommitted
t1509: fix failing "root work tree" test due to owner-check
When 8959555 (setup_git_directory(): add an owner check for the top-level directory, 2022-03-02) tightened security surrounding directory ownership, it neglected to adjust t1509-root-work-tree.sh to take the new restriction into account. As a result, since the root directory `/` is typically not owned by the user running the test (indeed, t1509 refuses to run as `root`), the ownership check added by 8959555 kicks in and causes the test to fail: fatal: detected dubious ownership in repository at '/' To add an exception for this directory, call: git config --global --add safe.directory / This problem went unnoticed for so long because t1509 is rarely run since it requires setting up a `chroot` environment or a sacrificial virtual machine in which `/` can be made writable and polluted by any user. Signed-off-by: Eric Sunshine <[email protected]>
1 parent e7e5c6f commit 7790b8c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

t/t1509-root-work-tree.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ test_expect_success 'setup' '
221221
rm -rf /.git &&
222222
echo "Initialized empty Git repository in /.git/" > expected &&
223223
git init > result &&
224-
test_cmp expected result
224+
test_cmp expected result &&
225+
git config --global --add safe.directory /
225226
'
226227

227228
test_vars 'auto gitdir, root' ".git" "/" ""

0 commit comments

Comments
 (0)