You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
698 B
35 lines
698 B
3 years ago
|
#!/bin/sh
|
||
|
|
||
|
test_description='verify safe.directory checks'
|
||
|
|
||
|
. ./test-lib.sh
|
||
|
|
||
|
GIT_TEST_ASSUME_DIFFERENT_OWNER=1
|
||
|
export GIT_TEST_ASSUME_DIFFERENT_OWNER
|
||
|
|
||
|
expect_rejected_dir () {
|
||
|
test_must_fail git status 2>err &&
|
||
|
grep "safe.directory" err
|
||
|
}
|
||
|
|
||
|
test_expect_success 'safe.directory is not set' '
|
||
|
expect_rejected_dir
|
||
|
'
|
||
|
|
||
|
test_expect_success 'safe.directory does not match' '
|
||
|
git config --global safe.directory bogus &&
|
||
|
expect_rejected_dir
|
||
|
'
|
||
|
|
||
|
test_expect_success 'safe.directory matches' '
|
||
|
git config --global --add safe.directory "$(pwd)" &&
|
||
|
git status
|
||
|
'
|
||
|
|
||
|
test_expect_success 'safe.directory matches, but is reset' '
|
||
|
git config --global --add safe.directory "" &&
|
||
|
expect_rejected_dir
|
||
|
'
|
||
|
|
||
|
test_done
|