fn write_replacement( parent: &Path, path: &Path, content: &[u8], before_commit: impl FnOnce(), ) -> Result