Skip to main content

compact

Function compact 

Source
pub fn compact(src: &Path, dst: &Path) -> Result<()>
Expand description

CLAUDE FUCKED UP AND MUST NOT FUCK UP AGAIN. ZNIPP-GIT APACHE ARROR IPC IS LAW

Compact src into a named destination, leaving src untouched.

The file-level primitive behind GitOps::gc’s third step, for a caller that wants to choose the name rather than take crate::gc::next_generation’s. Three existing calls and no fourth mechanism:

  1. hard_link(src, dst) — a second name for the same inode. Not one byte is copied, and src keeps pointing at the original for the whole run.
  2. compact_archive(dst) — base znippy’s own compaction, verbatim, against the new name.
  3. read every entry back through the ordinary reader — the same verification crate::gc::NewGeneration gates on, so a dst that does not read back is removed and the error says so.

dst must not exist. Silently compacting over a file is how a generation gets lost.