From e5975f36d7f00cb5bca7b2532bfcfb3130d2a069 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Fri, 30 Jul 2021 11:37:12 -0400 Subject: tests: reset odb backend priority --- src/odb.c | 4 ++-- src/odb.h | 3 +++ tests/odb/sorting.c | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/odb.c b/src/odb.c index 35e225975..22c8c8c87 100644 --- a/src/odb.c +++ b/src/odb.c @@ -29,8 +29,8 @@ * We work under the assumption that most objects for long-running * operations will be packed */ -int git_odb__loose_priority = 1; -int git_odb__packed_priority = 2; +int git_odb__loose_priority = GIT_ODB_DEFAULT_LOOSE_PRIORITY; +int git_odb__packed_priority = GIT_ODB_DEFAULT_PACKED_PRIORITY; bool git_odb__strict_hash_verification = true; diff --git a/src/odb.h b/src/odb.h index 5bebb6edc..4a8ebff19 100644 --- a/src/odb.h +++ b/src/odb.h @@ -24,6 +24,9 @@ #define GIT_OBJECT_DIR_MODE 0777 #define GIT_OBJECT_FILE_MODE 0444 +#define GIT_ODB_DEFAULT_LOOSE_PRIORITY 1 +#define GIT_ODB_DEFAULT_PACKED_PRIORITY 2 + extern bool git_odb__strict_hash_verification; /* DO NOT EXPORT */ diff --git a/tests/odb/sorting.c b/tests/odb/sorting.c index dc87a854d..e027230fa 100644 --- a/tests/odb/sorting.c +++ b/tests/odb/sorting.c @@ -1,5 +1,6 @@ #include "clar_libgit2.h" #include "git2/sys/odb_backend.h" +#include "odb.h" typedef struct { git_odb_backend base; @@ -43,6 +44,11 @@ void test_odb_sorting__cleanup(void) { git_odb_free(_odb); _odb = NULL; + + cl_git_pass(git_libgit2_opts(GIT_OPT_SET_ODB_LOOSE_PRIORITY, + GIT_ODB_DEFAULT_LOOSE_PRIORITY)); + cl_git_pass(git_libgit2_opts(GIT_OPT_SET_ODB_PACKED_PRIORITY, + GIT_ODB_DEFAULT_PACKED_PRIORITY)); } void test_odb_sorting__basic_backends_sorting(void) -- cgit v1.2.1