Skip to main content

store_version_text

Function store_version_text 

Source
pub fn store_version_text(
    directory: &Path,
    identity: &BinaryIdentity,
    text: &[u8],
)
Expand description

What: Record text for this identity, replacing any earlier entry, and report nothing when recording is impossible. Why: The write goes to a private temporary file and is renamed over the entry, so a reader sees the old entry or the new one whole; it is not synced because a lost entry only costs one git version start. A failure to record is logged and never fails the command.

In TS you’d write (pseudocode):

await mkdir(dir, { recursive: true, mode: 0o700 }); await writeFile(tmp, bytes, { mode: 0o600 }); await rename(tmp, file);