Skip to main content

clean

Function clean 

Source
pub fn clean<R: Read, W: Write>(
    store: &Store,
    input: &mut R,
    output: &mut W,
) -> Result<CleanOutcome, StoreError>
Expand description

Apply the clean filter to input, writing the resulting pointer (or the pass-through bytes) to output.

Algorithm (matches upstream gitfilter_clean.go):

  1. Read up to MAX_POINTER_SIZE bytes.
  2. If those bytes parse as a valid pointer, emit them verbatim (CleanOutcome::Passthrough).
  3. Otherwise stream the buffered head + the rest of input into the Store, computing SHA-256 as we go, and emit the canonical encoding of the resulting pointer (CleanOutcome::Stored).