33#include "sysdir.h"
44#include <ctype.h>
55
6+ static int validate_ownership = 0 ;
67static git_buf config_path = GIT_BUF_INIT ;
78
89void test_repo_open__initialize (void )
910{
1011 cl_git_pass (git_libgit2_opts (GIT_OPT_GET_SEARCH_PATH , GIT_CONFIG_LEVEL_GLOBAL , & config_path ));
12+ cl_git_pass (git_libgit2_opts (GIT_OPT_GET_OWNER_VALIDATION , & validate_ownership ));
1113}
1214
1315void test_repo_open__cleanup (void )
@@ -23,6 +25,8 @@ void test_repo_open__cleanup(void)
2325
2426 cl_git_pass (git_libgit2_opts (GIT_OPT_SET_SEARCH_PATH , GIT_CONFIG_LEVEL_GLOBAL , config_path .ptr ));
2527 git_buf_dispose (& config_path );
28+
29+ cl_git_pass (git_libgit2_opts (GIT_OPT_SET_OWNER_VALIDATION , validate_ownership ));
2630}
2731
2832void test_repo_open__bare_empty_repo (void )
@@ -470,6 +474,8 @@ void test_repo_open__validates_dir_ownership(void)
470474{
471475 git_repository * repo ;
472476
477+ cl_git_pass (git_libgit2_opts (GIT_OPT_SET_OWNER_VALIDATION , 1 ));
478+
473479 cl_fixture_sandbox ("empty_standard_repo" );
474480 cl_git_pass (cl_rename ("empty_standard_repo/.gitted" , "empty_standard_repo/.git" ));
475481
@@ -494,6 +500,8 @@ void test_repo_open__can_allowlist_dirs_with_problematic_ownership(void)
494500 config_filename = GIT_BUF_INIT ,
495501 config_data = GIT_BUF_INIT ;
496502
503+ cl_git_pass (git_libgit2_opts (GIT_OPT_SET_OWNER_VALIDATION , 1 ));
504+
497505 cl_fixture_sandbox ("empty_standard_repo" );
498506 cl_git_pass (cl_rename ("empty_standard_repo/.gitted" , "empty_standard_repo/.git" ));
499507
@@ -537,6 +545,8 @@ void test_repo_open__can_reset_safe_directory_list(void)
537545 config_filename = GIT_BUF_INIT ,
538546 config_data = GIT_BUF_INIT ;
539547
548+ cl_git_pass (git_libgit2_opts (GIT_OPT_SET_OWNER_VALIDATION , 1 ));
549+
540550 cl_fixture_sandbox ("empty_standard_repo" );
541551 cl_git_pass (cl_rename ("empty_standard_repo/.gitted" , "empty_standard_repo/.git" ));
542552
0 commit comments