Skip to content

Commit f98dd54

Browse files
authored
Merge pull request libgit2#6321 from libgit2/ethomson/ownership
repo: allow administrator to own the configuration
2 parents 05f2115 + cdff2f0 commit f98dd54

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/libgit2/repository.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ static int validate_ownership(const char *repo_path)
512512
bool is_safe;
513513
int error;
514514

515-
if ((error = git_fs_path_owner_is_current_user(&is_safe, repo_path)) < 0) {
515+
if ((error = git_fs_path_owner_is_system_or_current_user(&is_safe, repo_path)) < 0) {
516516
if (error == GIT_ENOTFOUND)
517517
error = 0;
518518

tests/libgit2/repo/open.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,10 @@ void test_repo_open__validates_dir_ownership(void)
484484
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
485485
git_repository_free(repo);
486486

487-
/* When the system user owns the repo config, fail */
487+
/* When the system user owns the repo config, also acceptable */
488488
git_fs_path__set_owner(GIT_FS_PATH_MOCK_OWNER_SYSTEM);
489-
cl_git_fail(git_repository_open(&repo, "empty_standard_repo"));
489+
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
490+
git_repository_free(repo);
490491

491492
/* When an unknown user owns the repo config, fail */
492493
git_fs_path__set_owner(GIT_FS_PATH_MOCK_OWNER_OTHER);

0 commit comments

Comments
 (0)