diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-04-13 15:21:31 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-04-13 15:21:31 -0700 |
commit | 2f0dde7852b7866bb044926f73334ff3fc30654b (patch) | |
tree | f0dfa3cb9c28475d7d3bd80a2572d4e4751e3bf7 /t | |
parent | Git 2.34.2 (diff) | |
parent | Git 2.33.3 (diff) | |
download | tgif-2f0dde7852b7866bb044926f73334ff3fc30654b.tar.xz |
Git 2.34.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t0033-safe-directory.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/t/t0033-safe-directory.sh b/t/t0033-safe-directory.sh new file mode 100755 index 0000000000..239d93f4d2 --- /dev/null +++ b/t/t0033-safe-directory.sh @@ -0,0 +1,49 @@ +#!/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 'path exist as different key' ' + git config --global foo.bar "$(pwd)" && + 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_expect_success 'safe.directory=*' ' + git config --global --add safe.directory "*" && + git status +' + +test_expect_success 'safe.directory=*, but is reset' ' + git config --global --add safe.directory "" && + expect_rejected_dir +' + +test_done |