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
This commit is contained in:
Junio C Hamano
2022-03-25 16:38:24 -07:00
26 changed files with 444 additions and 60 deletions

View File

@ -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"));
}