3 test_description
='verify safe.directory checks'
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' '
19 test_expect_success
'ignoring safe.directory on the command line' '
20 test_must_fail git -c safe.directory="$(pwd)" status 2>err &&
21 grep "dubious ownership" err
24 test_expect_success
'ignoring safe.directory in the environment' '
25 test_must_fail env GIT_CONFIG_COUNT=1 \
26 GIT_CONFIG_KEY_0="safe.directory" \
27 GIT_CONFIG_VALUE_0="$(pwd)" \
29 grep "dubious ownership" err
32 test_expect_success
'ignoring safe.directory in GIT_CONFIG_PARAMETERS' '
34 GIT_CONFIG_PARAMETERS="${SQ}safe.directory${SQ}=${SQ}$(pwd)${SQ}" \
36 grep "dubious ownership" err
39 test_expect_success
'ignoring safe.directory in repo config' '
41 unset GIT_TEST_ASSUME_DIFFERENT_OWNER &&
42 git config safe.directory "$(pwd)"
47 test_expect_success
'safe.directory does not match' '
48 git config --global safe.directory bogus &&
52 test_expect_success
'path exist as different key' '
53 git config --global foo.bar "$(pwd)" &&
57 test_expect_success
'safe.directory matches' '
58 git config --global --add safe.directory "$(pwd)" &&
62 test_expect_success
'safe.directory matches, but is reset' '
63 git config --global --add safe.directory "" &&
67 test_expect_success
'safe.directory=*' '
68 git config --global --add safe.directory "*" &&
72 test_expect_success
'safe.directory=*, but is reset' '
73 git config --global --add safe.directory "" &&