Expand description
Repository durability policy: core.fsync component selection and
core.fsyncMethod barrier choice.
Promoted from sley-refs so every writer resolves one shared policy
instead of hand-rolling barrier decisions. Mirrors upstream git 2.55:
- component bit layout and aggregate groups (
write-or-die.h), - the
core.fsyncgrammar with negation accumulation order and prefix matching (environment.cparse_fsync_components), - method selection including the platform default (
FSYNC_METHOD_DEFAULT; sley keeps the Windowsbatchmapping used by its reference store), and - the
GIT_TEST_FSYNCkill switch (write-or-die.cmaybe_fsync, default enabled).
Token handling follows the established sley grammar (sley-refs
core_fsync_includes_reference): comma-separated components are trimmed,
so unlike upstream’s raw strspn/strncmp scan a trailing space inside a
token still matches. Unknown components are ignored.
Structs§
- Fsync
Components - The set of repository parts to harden through an
FsyncMethodbarrier, mirroring upstreamenum fsync_component(git 2.55write-or-die.h). - Policy
- Resolved durability policy for repository writes.
Enums§
- Fsync
Method - Barrier implementation backing
core.fsyncMethod, mirroring upstreamenum fsync_method.
Traits§
- Fsync
Config Source - Minimal read-only config lookup surface accepted by
Policy::resolve.
Functions§
- sync_
file - Open
pathfor writing (no truncate, no create) and applypolicy’s barrier forcomponent. Convenience for post-hoc hardening of already published files; write paths that hold the handle open should preferPolicy::applydirectly. Requires write access becausesync_alldegrades to a permission error on read-only handles (WindowsFlushFileBufferssemantics). - test_
fsync_ enabled - Whether
GIT_TEST_FSYNCpermits real barriers. Upstream reads this as a boolean throughgit_env_bool("GIT_TEST_FSYNC", 1)insidemaybe_fsync; unrecognized spellings leave syncing enabled.