diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2021-12-12 09:19:25 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-06-20 17:09:47 -0400 |
| commit | 4d7ec76c42d9bcf2ed4f59e0efff2f4e6e810808 (patch) | |
| tree | 39a049a75076b45abefe99554a21637c63f1abd2 /tests/libgit2/odb | |
| parent | dbccfc203e776196ea2901dbcb652bba6a848a30 (diff) | |
| download | libgit2-4d7ec76c42d9bcf2ed4f59e0efff2f4e6e810808.tar.gz | |
odb: add git_odb_loose_backend_options
Move the arguments to `git_odb_loose` into an options structure.
Diffstat (limited to 'tests/libgit2/odb')
| -rw-r--r-- | tests/libgit2/odb/loose.c | 15 | ||||
| -rw-r--r-- | tests/libgit2/odb/sorting.c | 3 |
2 files changed, 15 insertions, 3 deletions
diff --git a/tests/libgit2/odb/loose.c b/tests/libgit2/odb/loose.c index 5da1f09df..20b329f69 100644 --- a/tests/libgit2/odb/loose.c +++ b/tests/libgit2/odb/loose.c @@ -196,6 +196,7 @@ static void test_write_object_permission( git_oid oid; struct stat statbuf; mode_t mask, os_mask; + git_odb_backend_loose_options opts = GIT_ODB_BACKEND_LOOSE_OPTIONS_INIT; /* Windows does not return group/user bits from stat, * files are never executable. @@ -209,8 +210,11 @@ static void test_write_object_permission( mask = p_umask(0); p_umask(mask); + opts.dir_mode = dir_mode; + opts.file_mode = file_mode; + cl_git_pass(git_odb_new(&odb, NULL)); - cl_git_pass(git_odb_backend_loose(&backend, "test-objects", -1, 0, dir_mode, file_mode)); + cl_git_pass(git_odb_backend_loose(&backend, "test-objects", &opts)); cl_git_pass(git_odb_add_backend(odb, backend, 1)); cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJECT_BLOB)); @@ -243,9 +247,16 @@ static void write_object_to_loose_odb(int fsync) git_odb *odb; git_odb_backend *backend; git_oid oid; + git_odb_backend_loose_options opts = GIT_ODB_BACKEND_LOOSE_OPTIONS_INIT; + + if (fsync) + opts.flags |= GIT_ODB_BACKEND_LOOSE_FSYNC; + + opts.dir_mode = 0777; + opts.file_mode = 0666; cl_git_pass(git_odb_new(&odb, NULL)); - cl_git_pass(git_odb_backend_loose(&backend, "test-objects", -1, fsync, 0777, 0666)); + cl_git_pass(git_odb_backend_loose(&backend, "test-objects", &opts)); cl_git_pass(git_odb_add_backend(odb, backend, 1)); cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJECT_BLOB)); git_odb_free(odb); diff --git a/tests/libgit2/odb/sorting.c b/tests/libgit2/odb/sorting.c index 36c45071e..33ce289b5 100644 --- a/tests/libgit2/odb/sorting.c +++ b/tests/libgit2/odb/sorting.c @@ -79,10 +79,11 @@ void test_odb_sorting__override_default_backend_priority(void) { git_odb *new_odb; git_odb_backend *loose, *packed, *backend; + cl_git_pass(git_libgit2_opts(GIT_OPT_SET_ODB_LOOSE_PRIORITY, 5)); cl_git_pass(git_libgit2_opts(GIT_OPT_SET_ODB_PACKED_PRIORITY, 3)); git_odb_backend_pack(&packed, "./testrepo.git/objects"); - git_odb_backend_loose(&loose, "./testrepo.git/objects", -1, 0, 0, 0); + git_odb_backend_loose(&loose, "./testrepo.git/objects", NULL); cl_git_pass(git_odb_open(&new_odb, cl_fixture("testrepo.git/objects"), NULL)); cl_assert_equal_sz(2, git_odb_num_backends(new_odb)); |
