]> git.ipfire.org Git - thirdparty/git.git/blobdiff - setup.c
Git 2.32.2
[thirdparty/git.git] / setup.c
diff --git a/setup.c b/setup.c
index 5c5ad90efccca4e0f3c9aa4f72c785564a974f69..f4c9a542c2c21ce95ff2f841bd419400263200a2 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -1034,9 +1034,14 @@ static int safe_directory_cb(const char *key, const char *value, void *d)
 {
        struct safe_directory_data *data = d;
 
-       if (!value || !*value)
+       if (strcmp(key, "safe.directory"))
+               return 0;
+
+       if (!value || !*value) {
                data->is_safe = 0;
-       else {
+       } else if (!strcmp(value, "*")) {
+               data->is_safe = 1;
+       } else {
                const char *interpolated = NULL;
 
                if (!git_config_pathname(&interpolated, key, value) &&
@@ -1053,7 +1058,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);