gix_filter::eol

Function convert_to_git

source
pub fn convert_to_git(
    src: &[u8],
    digest: AttributesDigest,
    buf: &mut Vec<u8>,
    index_object: &mut IndexObjectFn<'_>,
    _: Options<'_>,
) -> Result<bool, Error>
Expand description

Given a src buffer, change it git (\n) line endings and store the result in buf. Return true if buf was written or false if nothing had to be done. Depending on the state in buf, index_object is called to write the version of src as stored in the index into the buffer and if it is a blob, or return Ok(None) if no such object exists.

If renormalization is desired, let it return Ok(None) at all times to not let it have any influence over the outcome of this function. Otherwise, it will check if the in-index buffer already has newlines that it would now want to change, and avoid doing so as what’s in Git should be what’s desired (except for when renormalizing). If round_trip_check is not None, round-tripping will be validated and handled accordingly.