gix_filter::ident

Function apply

Source
pub fn apply(
    src: &[u8],
    object_hash: Kind,
    buf: &mut Vec<u8>,
) -> Result<bool, TryReserveError>
Expand description

Substitute all occurrences of $Id$ with $Id: <hexsha-of-input>$ if present in src and write all changes to buf, with object_hash being used accordingly. Return true if buf was written to or false if no change was made (as there was nothing to do).

§Deviation

Git also tries to cleanup ‘stray’ substituted $Id: <hex>$, but we don’t do that, sticking exactly to what ought to be done. The respective code is up to 16 years old and one might assume that git by now handles checking and checkout filters correctly.