Struct gix_filter::Pipeline
source · pub struct Pipeline { /* private fields */ }Expand description
The standard git filter pipeline comprised of multiple standard filters and support for external filters.
It’s configuring itself for each provided path based on the path’s attributes, implementing the complex logic that governs it.
Implementations§
source§impl Pipeline
impl Pipeline
Access
sourcepub fn convert_to_git<E, R>(
&mut self,
src: R,
rela_path: &Path,
attributes: impl FnOnce(&BStr, &mut Outcome),
index_object: impl FnOnce(&BStr, &mut Vec<u8>) -> Result<Option<()>, E>
) -> Result<ToGitOutcome<'_, R>, Error>where
R: Read,
E: Error + Send + Sync + 'static,
pub fn convert_to_git<E, R>( &mut self, src: R, rela_path: &Path, attributes: impl FnOnce(&BStr, &mut Outcome), index_object: impl FnOnce(&BStr, &mut Vec<u8>) -> Result<Option<()>, E> ) -> Result<ToGitOutcome<'_, R>, Error>where R: Read, E: Error + Send + Sync + 'static,
Convert a src stream (to be found at rela_path) to a representation suitable for storage in git
based on the attributes at rela_path which is passed as first argument..
When converting to crlf, and depending on the configuration, index_object might be called to obtain the index
version of src if available. It can return Ok(None) if this information isn’t available.
sourcepub fn convert_to_worktree<'input>(
&mut self,
src: &'input [u8],
rela_path: &BStr,
attributes: impl FnOnce(&BStr, &mut Outcome),
can_delay: Delay
) -> Result<ToWorktreeOutcome<'input, '_>, Error>
pub fn convert_to_worktree<'input>( &mut self, src: &'input [u8], rela_path: &BStr, attributes: impl FnOnce(&BStr, &mut Outcome), can_delay: Delay ) -> Result<ToWorktreeOutcome<'input, '_>, Error>
Convert a src buffer located at rela_path (in the index) from what’s in git to the worktree representation,
asking for attributes with rela_path as first argument to configure the operation automatically.
can_delay defines if long-running processes can delay their response, and if they choose to the caller has to
specifically deal with it by interacting with the driver_state directly.
The reason src is a buffer is to indicate that git generally doesn’t do well streaming data, so it should be small enough
to be performant while being held in memory. This is typically the case, especially if git-lfs is used as intended.
source§impl Pipeline
impl Pipeline
Lifecycle
sourcepub fn new(collection: &MetadataCollection, options: Options) -> Self
pub fn new(collection: &MetadataCollection, options: Options) -> Self
Create a new pipeline with configured drivers (which should be considered safe to invoke) as well as a way to initialize
our attributes with collection.
eol_config serves as fallback to understand how to convert line endings if no line-ending attributes are present.
crlf_roundtrip_check corresponds to the git-configuration of core.safecrlf.
object_hash is relevant for the ident filter.
sourcepub fn into_driver_state(self) -> State
pub fn into_driver_state(self) -> State
Turn ourselves into state managing possibly running driver processes.
This can be used to control how these are terminated via driver::State::shutdown().
source§impl Pipeline
impl Pipeline
Access
sourcepub fn driver_state_mut(&mut self) -> &mut State
pub fn driver_state_mut(&mut self) -> &mut State
Return a mutable reference to the state that handles long running processes. Interacting with it directly allows to handle delayed results.
sourcepub fn driver_context_mut(&mut self) -> &mut Context
pub fn driver_context_mut(&mut self) -> &mut Context
Provide mutable context that is made available to the process filters.
The context set here is relevant for the convert_to_git() and
convert_to_worktree() methods.
sourcepub fn options_mut(&mut self) -> &mut Options
pub fn options_mut(&mut self) -> &mut Options
Return a set of options for configuration after instantiation.