summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-07-30 10:32:02 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-07-30 10:32:02 -0400
commite87bcb3d770316fcb59f35d0aa6919c14a2a0eaa (patch)
tree4027db206ae354a5147d07f6c555878a4cd12994 /src
parent0c34767e68977f53698e48dbb399e7a6c7c5d2dd (diff)
parentcd460522c516f18a12549626a356960370e3bcc7 (diff)
downloadlibgit2-e87bcb3d770316fcb59f35d0aa6919c14a2a0eaa.tar.gz
Merge branch 'pr/5491'
Diffstat (limited to 'src')
-rw-r--r--src/libgit2.c10
-rw-r--r--src/odb.c12
2 files changed, 16 insertions, 6 deletions
diff --git a/src/libgit2.c b/src/libgit2.c
index f27c9997d..089c83590 100644
--- a/src/libgit2.c
+++ b/src/libgit2.c
@@ -50,6 +50,8 @@ extern size_t git_mwindow__mapped_limit;
extern size_t git_mwindow__file_limit;
extern size_t git_indexer__max_objects;
extern bool git_disable_pack_keep_file_checks;
+extern int git_odb__packed_priority;
+extern int git_odb__loose_priority;
char *git__user_agent;
char *git__ssl_ciphers;
@@ -368,6 +370,14 @@ int git_libgit2_opts(int key, ...)
git_http__expect_continue = (va_arg(ap, int) != 0);
break;
+ case GIT_OPT_SET_ODB_PACKED_PRIORITY:
+ git_odb__packed_priority = va_arg(ap, int);
+ break;
+
+ case GIT_OPT_SET_ODB_LOOSE_PRIORITY:
+ git_odb__loose_priority = va_arg(ap, int);
+ break;
+
default:
git_error_set(GIT_ERROR_INVALID, "invalid option key");
error = -1;
diff --git a/src/odb.c b/src/odb.c
index 05bdaf6a3..35e225975 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -23,14 +23,14 @@
#define GIT_ALTERNATES_FILE "info/alternates"
+#define GIT_ALTERNATES_MAX_DEPTH 5
+
/*
* We work under the assumption that most objects for long-running
* operations will be packed
*/
-#define GIT_LOOSE_PRIORITY 1
-#define GIT_PACKED_PRIORITY 2
-
-#define GIT_ALTERNATES_MAX_DEPTH 5
+int git_odb__loose_priority = 1;
+int git_odb__packed_priority = 2;
bool git_odb__strict_hash_verification = true;
@@ -613,12 +613,12 @@ int git_odb__add_default_backends(
/* add the loose object backend */
if (git_odb_backend_loose(&loose, objects_dir, -1, db->do_fsync, 0, 0) < 0 ||
- add_backend_internal(db, loose, GIT_LOOSE_PRIORITY, as_alternates, inode) < 0)
+ add_backend_internal(db, loose, git_odb__loose_priority, as_alternates, inode) < 0)
return -1;
/* add the packed file backend */
if (git_odb_backend_pack(&packed, objects_dir) < 0 ||
- add_backend_internal(db, packed, GIT_PACKED_PRIORITY, as_alternates, inode) < 0)
+ add_backend_internal(db, packed, git_odb__packed_priority, as_alternates, inode) < 0)
return -1;
if (git_mutex_lock(&db->lock) < 0) {