diff options
Diffstat (limited to 'tests/pack/packbuilder.c')
-rw-r--r-- | tests/pack/packbuilder.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/pack/packbuilder.c b/tests/pack/packbuilder.c index 5cdd9a8d2..1d7becef7 100644 --- a/tests/pack/packbuilder.c +++ b/tests/pack/packbuilder.c @@ -198,22 +198,31 @@ void test_pack_packbuilder__does_not_fsync_by_default(void) cl_assert_equal_sz(0, p_fsync__cnt); } -void test_pack_packbuilder__fsync_when_asked(void) -{ - /* We fsync the packfile and index. On non-Windows, we also fsync - * the parent directories. - */ +/* We fsync the packfile and index. On non-Windows, we also fsync + * the parent directories. + */ #ifdef GIT_WIN32 - int expected = 2; +static int expected_fsyncs = 2; #else - int expected = 4; +static int expected_fsyncs = 4; #endif +void test_pack_packbuilder__fsync_global_setting(void) +{ cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION, 1)); p_fsync__cnt = 0; seed_packbuilder(); git_packbuilder_write(_packbuilder, ".", 0666, NULL, NULL); - cl_assert_equal_sz(expected, p_fsync__cnt); + cl_assert_equal_sz(expected_fsyncs, p_fsync__cnt); +} + +void test_pack_packbuilder__fsync_repo_setting(void) +{ + cl_repo_set_bool(_repo, "core.fsyncObjectFiles", true); + p_fsync__cnt = 0; + seed_packbuilder(); + git_packbuilder_write(_packbuilder, ".", 0666, NULL, NULL); + cl_assert_equal_sz(expected_fsyncs, p_fsync__cnt); } static int foreach_cb(void *buf, size_t len, void *payload) |