diff options
| author | Patrick Steinhardt <ps@pks.im> | 2017-06-08 21:40:18 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2017-06-08 21:40:18 +0200 |
| commit | 6c23704df5d19239f8c3d6f69da62bdbe1cf287d (patch) | |
| tree | 8bb883b7d787d5e28d2f68c08b22dc311d0e258e /src | |
| parent | 458cea5c5b820f9766cb5ba4c3d89830592d655b (diff) | |
| download | libgit2-6c23704df5d19239f8c3d6f69da62bdbe1cf287d.tar.gz | |
settings: rename `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`
Initially, the setting has been solely used to enable the use of
`fsync()` when creating objects. Since then, the use has been extended
to also cover references and index files. As the option is not yet part
of any release, we can still correct this by renaming the option to
something more sensible, indicating not only correlation to objects.
This commit renames the option to `GIT_OPT_ENABLE_FSYNC_GITDIR`. We also
move the variable from the object to repository source code.
Diffstat (limited to 'src')
| -rw-r--r-- | src/indexer.c | 2 | ||||
| -rw-r--r-- | src/object.c | 1 | ||||
| -rw-r--r-- | src/object.h | 1 | ||||
| -rw-r--r-- | src/odb_loose.c | 2 | ||||
| -rw-r--r-- | src/refdb_fs.c | 2 | ||||
| -rw-r--r-- | src/repository.c | 2 | ||||
| -rw-r--r-- | src/repository.h | 2 | ||||
| -rw-r--r-- | src/settings.c | 4 |
8 files changed, 9 insertions, 7 deletions
diff --git a/src/indexer.c b/src/indexer.c index ce67240ce..68cd205e0 100644 --- a/src/indexer.c +++ b/src/indexer.c @@ -125,7 +125,7 @@ int git_indexer_new( git_hash_ctx_init(&idx->hash_ctx); git_hash_ctx_init(&idx->trailer); - if (git_object__synchronous_writing) + if (git_repository__fsync_gitdir) idx->do_fsync = 1; error = git_buf_joinpath(&path, prefix, suff); diff --git a/src/object.c b/src/object.c index bd87c9310..2da36a2ee 100644 --- a/src/object.c +++ b/src/object.c @@ -16,7 +16,6 @@ #include "tag.h" bool git_object__strict_input_validation = true; -bool git_object__synchronous_writing = false; typedef struct { const char *str; /* type name string */ diff --git a/src/object.h b/src/object.h index 13117e4c3..dd227d16d 100644 --- a/src/object.h +++ b/src/object.h @@ -10,7 +10,6 @@ #include "repository.h" extern bool git_object__strict_input_validation; -extern bool git_object__synchronous_writing; /** Base git object for inheritance */ struct git_object { diff --git a/src/odb_loose.c b/src/odb_loose.c index a97ac25eb..99fdcb44f 100644 --- a/src/odb_loose.c +++ b/src/odb_loose.c @@ -850,7 +850,7 @@ static int filebuf_flags(loose_backend *backend) int flags = GIT_FILEBUF_TEMPORARY | (backend->object_zlib_level << GIT_FILEBUF_DEFLATE_SHIFT); - if (backend->fsync_object_files || git_object__synchronous_writing) + if (backend->fsync_object_files || git_repository__fsync_gitdir) flags |= GIT_FILEBUF_FSYNC; return flags; diff --git a/src/refdb_fs.c b/src/refdb_fs.c index 988a14b85..eb135dc01 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -2032,7 +2032,7 @@ int git_refdb_backend_fs( backend->direach_flags |= GIT_PATH_DIR_PRECOMPOSE_UNICODE; } if ((!git_repository__cvar(&t, backend->repo, GIT_CVAR_FSYNCOBJECTFILES) && t) || - git_object__synchronous_writing) + git_repository__fsync_gitdir) backend->fsync = 1; backend->parent.exists = &refdb_fs_backend__exists; diff --git a/src/repository.c b/src/repository.c index d0a38cc6a..c7b40fdf7 100644 --- a/src/repository.c +++ b/src/repository.c @@ -36,6 +36,8 @@ # include "win32/w32_util.h" #endif +bool git_repository__fsync_gitdir = false; + static const struct { git_repository_item_t parent; const char *name; diff --git a/src/repository.h b/src/repository.h index f922d00f2..52f9ec260 100644 --- a/src/repository.h +++ b/src/repository.h @@ -31,6 +31,8 @@ /* Default DOS-compatible 8.3 "short name" for a git repository, "GIT~1" */ #define GIT_DIR_SHORTNAME "GIT~1" +extern bool git_repository__fsync_gitdir; + /** Cvar cache identifiers */ typedef enum { GIT_CVAR_AUTO_CRLF = 0, /* core.autocrlf */ diff --git a/src/settings.c b/src/settings.c index 25c5aae6d..52b861ba0 100644 --- a/src/settings.c +++ b/src/settings.c @@ -228,8 +228,8 @@ int git_libgit2_opts(int key, ...) git_smart__ofs_delta_enabled = (va_arg(ap, int) != 0); break; - case GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION: - git_object__synchronous_writing = (va_arg(ap, int) != 0); + case GIT_OPT_ENABLE_FSYNC_GITDIR: + git_repository__fsync_gitdir = (va_arg(ap, int) != 0); break; case GIT_OPT_GET_WINDOWS_SHAREMODE: |
