diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-03-25 23:38:24 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-25 23:38:24 (GMT) |
commit | eb804cd405618ef78b772072685c39392aea4ac1 (patch) | |
tree | c86dd22ade3bf93d03d9ac01c507c6254c8fee7a /object-file.c | |
parent | a68dfadae5e95c7f255cf38c9efdcbc2e36d1931 (diff) | |
parent | b9f5d0358d2e882d47f496c1a5589f6cebc25578 (diff) | |
download | git-eb804cd405618ef78b772072685c39392aea4ac1.zip git-eb804cd405618ef78b772072685c39392aea4ac1.tar.gz git-eb804cd405618ef78b772072685c39392aea4ac1.tar.bz2 |
Merge branch 'ns/core-fsyncmethod'
Replace core.fsyncObjectFiles with two new configuration variables,
core.fsync and core.fsyncMethod.
* ns/core-fsyncmethod:
core.fsync: documentation and user-friendly aggregate options
core.fsync: new option to harden the index
core.fsync: add configuration parsing
core.fsync: introduce granular fsync control infrastructure
core.fsyncmethod: add writeout-only mode
wrapper: make inclusion of Windows csprng header tightly scoped
Diffstat (limited to 'object-file.c')
-rw-r--r-- | object-file.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/object-file.c b/object-file.c index bdc5cbd..62ebe23 100644 --- a/object-file.c +++ b/object-file.c @@ -1889,11 +1889,16 @@ void hash_object_file(const struct git_hash_algo *algo, const void *buf, /* Finalize a file on disk, and close it. */ static void close_loose_object(int fd) { - if (!the_repository->objects->odb->will_destroy) { - if (fsync_object_files) - fsync_or_die(fd, "loose object file"); - } + if (the_repository->objects->odb->will_destroy) + goto out; + if (fsync_object_files > 0) + fsync_or_die(fd, "loose object file"); + else + fsync_component_or_die(FSYNC_COMPONENT_LOOSE_OBJECT, fd, + "loose object file"); + +out: if (close(fd) != 0) die_errno(_("error when closing loose object file")); } |