Skip to main content

apply_delta

Function apply_delta 

Source
pub fn apply_delta(base: &[u8], delta: &[u8]) -> Result<Vec<u8>>
Expand description

Apply a git “patch delta” to base, producing the patched result.

The delta binary format is:

  1. Source size: variable-length little-endian integer (must equal base.len()).
  2. Destination size: variable-length little-endian integer.
  3. A sequence of COPY (MSB set) and INSERT (MSB clear) instructions.

§Errors

Returns Error::CorruptObject if the delta is malformed, the source-size field does not match base.len(), or the result length does not match the declared destination size.