Git 2.33.8
[git.git] / t / t0033-safe-directory.sh
blob22ae88398c722cc59241315ac5516c3f345b7174
1 #!/bin/sh
3 test_description='verify safe.directory checks'
5 . ./test-lib.sh
7 GIT_TEST_ASSUME_DIFFERENT_OWNER=1
8 export GIT_TEST_ASSUME_DIFFERENT_OWNER
10 expect_rejected_dir () {
11 test_must_fail git status 2>err &&
12 grep "dubious ownership" err
15 test_expect_success 'safe.directory is not set' '
16 expect_rejected_dir
19 test_expect_success 'safe.directory does not match' '
20 git config --global safe.directory bogus &&
21 expect_rejected_dir
24 test_expect_success 'path exist as different key' '
25 git config --global foo.bar "$(pwd)" &&
26 expect_rejected_dir
29 test_expect_success 'safe.directory matches' '
30 git config --global --add safe.directory "$(pwd)" &&
31 git status
34 test_expect_success 'safe.directory matches, but is reset' '
35 git config --global --add safe.directory "" &&
36 expect_rejected_dir
39 test_expect_success 'safe.directory=*' '
40 git config --global --add safe.directory "*" &&
41 git status
44 test_expect_success 'safe.directory=*, but is reset' '
45 git config --global --add safe.directory "" &&
46 expect_rejected_dir
49 test_done