Skip to main content

write_metadata_file_atomic

Function write_metadata_file_atomic 

Source
pub fn write_metadata_file_atomic(
    path: impl AsRef<Path>,
    bytes: &[u8],
    options: AtomicMetadataWriteOptions,
) -> Result<AtomicMetadataWriteResult>
Expand description

Write a git metadata file through a sibling .lock file and atomic rename.

This helper is intended for small repository/worktree metadata files such as HEAD, config.worktree, or state files under .git/. It deliberately does not try to replace object or pack writers, which have their own durability and naming rules.