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<R>(
&mut self,
src: R,
rela_path: &Path,
attributes: &mut dyn FnMut(&BStr, &mut Outcome),
index_object: &mut IndexObjectFn<'_>,
) -> Result<ToGitOutcome<'_, R>, Error>where
R: Read,
pub fn convert_to_git<R>(
&mut self,
src: R,
rela_path: &Path,
attributes: &mut dyn FnMut(&BStr, &mut Outcome),
index_object: &mut IndexObjectFn<'_>,
) -> Result<ToGitOutcome<'_, R>, Error>where
R: Read,
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: &mut dyn FnMut(&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: &mut dyn FnMut(&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(context: Context, options: Options) -> Self
pub fn new(context: Context, options: Options) -> Self
Create a new pipeline with configured drivers
(which should be considered safe to invoke), which are passed context
.
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.
Sourcepub fn buffers_mut(&mut self) -> &mut Buffers
pub fn buffers_mut(&mut self) -> &mut Buffers
Return our double-buffers for reuse by the caller.