pub struct Pipeline<'repo> { /* private fields */ }
attributes
only.Expand description
A git pipeline for transforming data to-git and to-worktree, based on git configuration and attributes.
Implementations§
source§impl<'repo> Pipeline<'repo>
impl<'repo> Pipeline<'repo>
Lifecycle
sourcepub fn options(repo: &'repo Repository) -> Result<Options, Error>
pub fn options(repo: &'repo Repository) -> Result<Options, Error>
Extract options from repo
that are needed to properly drive a standard git filter pipeline.
sourcepub fn new(repo: &'repo Repository, cache: Stack) -> Result<Self, Error>
pub fn new(repo: &'repo Repository, cache: Stack) -> Result<Self, Error>
Create a new instance by extracting all necessary information and configuration from a repo
along with cache
for accessing
attributes. The index
is used for some filters which may access it under very specific circumstances.
sourcepub fn into_parts(self) -> (Pipeline, Stack)
pub fn into_parts(self) -> (Pipeline, Stack)
Detach the repository and obtain the individual functional parts.
source§impl<'repo> Pipeline<'repo>
impl<'repo> Pipeline<'repo>
Conversions
sourcepub fn convert_to_git<R>(
&mut self,
src: R,
rela_path: &Path,
index: &State
) -> Result<ToGitOutcome<'_, R>, Error>where
R: Read,
pub fn convert_to_git<R>( &mut self, src: R, rela_path: &Path, index: &State ) -> Result<ToGitOutcome<'_, R>, Error>where R: Read,
Convert a src
stream (to be found at rela_path
, a repo-relative path) to a representation suitable for storage in git
by using all attributes at rela_path
and configuration of the repository to know exactly which filters apply.
index
is used in particularly rare cases where the CRLF filter in auto-mode tries to determine whether or not to apply itself,
and it should match the state used when instantiating this instance.
Note that the return-type implements std::io::Read
.
sourcepub fn convert_to_worktree<'input>(
&mut self,
src: &'input [u8],
rela_path: &BStr,
can_delay: Delay
) -> Result<ToWorktreeOutcome<'input, '_>, Error>
pub fn convert_to_worktree<'input>( &mut self, src: &'input [u8], rela_path: &BStr, 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.
This method will obtain all attributes and configuration necessary to know exactly which filters to apply.
Note that the return-type implements std::io::Read
.
Use can_delay
to tell driver processes that they may delay the return of data. Doing this will require the caller to specifically
handle delayed files by keeping state and using Self::into_parts()
to get access to the driver state to follow the delayed-files
protocol. For simplicity, most will want to disallow delayed processing.
sourcepub fn driver_context_mut(&mut self) -> &mut Context
pub fn driver_context_mut(&mut self) -> &mut Context
Retrieve the static 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.