aboutsummaryrefslogtreecommitdiffstats
path: root/setup.c
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-04-13 15:32:29 +0000
committerJunio C Hamano <gitster@pobox.com>2022-04-13 12:42:49 -0700
commite47363e5a8bdf5144059d664c45c0975243ef05b (patch)
tree87f72d7735188d4323446fe3b954389c3db6673a /setup.c
parentcb95038137e9e66fc6a6b4a0e8db62bcc521b709 (diff)
downloadgit-e47363e5a8bdf5144059d664c45c0975243ef05b.tar.gz
t0033: add tests for safe.directory
It is difficult to change the ownership on a directory in our test suite, so insert a new GIT_TEST_ASSUME_DIFFERENT_OWNER environment variable to trick Git into thinking we are in a differently-owned directory. This allows us to test that the config is parsed correctly. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/setup.c b/setup.c
index 95d5b00940..3c6ed17af9 100644
--- a/setup.c
+++ b/setup.c
@@ -1053,7 +1053,8 @@ static int ensure_valid_ownership(const char *path)
{
struct safe_directory_data data = { .path = path };
- if (is_path_owned_by_current_user(path))
+ if (!git_env_bool("GIT_TEST_ASSUME_DIFFERENT_OWNER", 0) &&
+ is_path_owned_by_current_user(path))
return 1;
read_very_early_config(safe_directory_cb, &data);