Skip to main content

encode_and_output_to_files

Function encode_and_output_to_files 

Source
pub async fn encode_and_output_to_files(
    raw_entries_rx: Receiver<MetaAttached<Entry, EntryMeta>>,
    object_number: usize,
    output_dir: PathBuf,
    window_size: usize,
) -> Result<(), GitError>
Expand description

Consume entries and write a matching .pack/.idx pair into output_dir.

The pack is first written to a temporary file because its final name contains the checksum, which is not known until encoding completes. A background task drains the encoder’s pack channel while the caller-facing task performs encoding. After the pack is finalized and renamed, a second writer drains the generated index bytes.

object_number must equal the number of entries eventually received. A window_size of zero disables delta compression; any non-zero value selects the delta-search path. The default build uses Rabin fingerprinting; builds without diff_rabin use Myers or Patience.