pub struct Pipeline<'repo> {
pub repo: &'repo Repository,
/* private fields */
}attributes only.Expand description
A git pipeline for transforming data to-git and to-worktree, based on git configuration and attributes.
Fields§
§repo: &'repo RepositoryThe repository this pipeline is associated with.
Implementations§
Source§impl<'repo> Pipeline<'repo>
Lifecycle
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 Pipeline<'_>
Conversions
impl Pipeline<'_>
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 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 worktree_file_to_object(
&mut self,
rela_path: &BStr,
index: &State,
) -> Result<Option<(ObjectId, EntryKind, Metadata)>, Error>
pub fn worktree_file_to_object( &mut self, rela_path: &BStr, index: &State, ) -> Result<Option<(ObjectId, EntryKind, Metadata)>, Error>
Add the worktree file at rela_path to the object database and return its (id, entry, symlink_metadata) for use in a tree or in the index, for instance.
If rela_path is a directory and is a repository with its HEAD pointing to a commit, it will also be provided with the appropriate kind.
Note that this can easily lead to embedded repositories as no submodule-crosscheck is performed. Otherwise, unreadable repositories or directories
are ignored with None as return value.
index is used in particularly rare cases where the CRLF filter in auto-mode tries to determine whether to apply itself,
and it should match the state used when instantiating this instance.
Return Ok(None) the file didn’t exist in the worktree, or if it was of an untrackable type.
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.