summaryrefslogtreecommitdiff
path: root/src/libgit2/repository.c
diff options
context:
space:
mode:
authorEdward Thomson <edward.thomson@vercel.com>2023-02-15 12:33:16 +0000
committerEdward Thomson <edward.thomson@vercel.com>2023-02-15 13:23:51 +0000
commit0642815f2018aee7a6d26d4e55d9b25cad950569 (patch)
tree9f2c207382ff0c952b61aebe87a32d414f4209c8 /src/libgit2/repository.c
parente9ee08f74fe745a4963b3c429192840b3b6fdf66 (diff)
downloadlibgit2-ethomson/warnings.tar.gz
repository: warn on safe.directory handlingethomson/warnings
Invoke the new warning callback for `safe.directory` failures.
Diffstat (limited to 'src/libgit2/repository.c')
-rw-r--r--src/libgit2/repository.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libgit2/repository.c b/src/libgit2/repository.c
index 489d627a0..9f583c4ad 100644
--- a/src/libgit2/repository.c
+++ b/src/libgit2/repository.c
@@ -34,6 +34,7 @@
#include "worktree.h"
#include "path.h"
#include "strmap.h"
+#include "warning.h"
#ifdef GIT_WIN32
# include "win32/w32_util.h"
@@ -590,7 +591,8 @@ static int validate_ownership(git_repository *repo)
(error = validate_ownership_config(&is_safe, validation_paths[0])) < 0)
goto done;
- if (!is_safe) {
+ if (!is_safe &&
+ git_warning(GIT_WARNING_SAFE_DIRECTORY, path) != GIT_WARNING_IGNORE) {
git_error_set(GIT_ERROR_CONFIG,
"repository path '%s' is not owned by current user",
path);