summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libgit2/libgit2.c8
-rw-r--r--src/libgit2/repository.c4
-rw-r--r--src/libgit2/repository.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/src/libgit2/libgit2.c b/src/libgit2/libgit2.c
index efad3bf6d..2fda0722e 100644
--- a/src/libgit2/libgit2.c
+++ b/src/libgit2/libgit2.c
@@ -406,6 +406,14 @@ int git_libgit2_opts(int key, ...)
}
break;
+ case GIT_OPT_GET_OWNER_VALIDATION:
+ *(va_arg(ap, int *)) = git_repository__validate_ownership;
+ break;
+
+ case GIT_OPT_SET_OWNER_VALIDATION:
+ git_repository__validate_ownership = (va_arg(ap, int) != 0);
+ break;
+
default:
git_error_set(GIT_ERROR_INVALID, "invalid option key");
error = -1;
diff --git a/src/libgit2/repository.c b/src/libgit2/repository.c
index 89fad823f..48a0b70f5 100644
--- a/src/libgit2/repository.c
+++ b/src/libgit2/repository.c
@@ -39,6 +39,7 @@
# include "win32/w32_util.h"
#endif
+bool git_repository__validate_ownership = true;
bool git_repository__fsync_gitdir = false;
static const struct {
@@ -977,7 +978,8 @@ int git_repository_open_ext(
*/
validation_path = repo->is_bare ? repo->gitdir : repo->workdir;
- if ((error = validate_ownership(validation_path)) < 0)
+ if (git_repository__validate_ownership &&
+ (error = validate_ownership(validation_path)) < 0)
goto cleanup;
cleanup:
diff --git a/src/libgit2/repository.h b/src/libgit2/repository.h
index 3c3aa1e8e..a488f2bf2 100644
--- a/src/libgit2/repository.h
+++ b/src/libgit2/repository.h
@@ -34,6 +34,7 @@
#define GIT_DIR_SHORTNAME "GIT~1"
extern bool git_repository__fsync_gitdir;
+extern bool git_repository__validate_ownership;
/** Cvar cache identifiers */
typedef enum {