summaryrefslogtreecommitdiff
path: root/tests/odb/loose.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2017-02-28 12:29:29 +0000
committerEdward Thomson <ethomson@github.com>2017-03-02 09:11:33 +0000
commit1c04a96b25da048221f31ecee0227d960dc00489 (patch)
tree14774879d60dec45b5610cb7ed1bae927ef2016f /tests/odb/loose.c
parent3ac05d11493d0573dbf725a19403dbf5e8d93b50 (diff)
downloadlibgit2-ethomson/fsync.tar.gz
Honor `core.fsyncObjectFiles`ethomson/fsync
Diffstat (limited to 'tests/odb/loose.c')
-rw-r--r--tests/odb/loose.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/odb/loose.c b/tests/odb/loose.c
index fd4a53837..dd686aa01 100644
--- a/tests/odb/loose.c
+++ b/tests/odb/loose.c
@@ -3,6 +3,7 @@
#include "git2/odb_backend.h"
#include "posix.h"
#include "loose_data.h"
+#include "repository.h"
#ifdef __ANDROID_API__
# define S_IREAD S_IRUSR
@@ -184,3 +185,23 @@ void test_odb_loose__fsync_obeys_global_setting(void)
write_object_to_loose_odb(0);
cl_assert(p_fsync__cnt > 0);
}
+
+void test_odb_loose__fsync_obeys_repo_setting(void)
+{
+ git_repository *repo;
+ git_odb *odb;
+ git_oid oid;
+
+ cl_git_pass(git_repository_init(&repo, "test-objects", 1));
+ cl_git_pass(git_repository_odb__weakptr(&odb, repo));
+ cl_git_pass(git_odb_write(&oid, odb, "No fsync here\n", 14, GIT_OBJ_BLOB));
+ cl_assert(p_fsync__cnt == 0);
+ git_repository_free(repo);
+
+ cl_git_pass(git_repository_open(&repo, "test-objects"));
+ cl_repo_set_bool(repo, "core.fsyncObjectFiles", true);
+ cl_git_pass(git_repository_odb__weakptr(&odb, repo));
+ cl_git_pass(git_odb_write(&oid, odb, "Now fsync\n", 10, GIT_OBJ_BLOB));
+ cl_assert(p_fsync__cnt > 0);
+ git_repository_free(repo);
+}