pub struct Pipeline {
pub roots: WorktreeRoots,
pub worktree_filter: Pipeline,
pub options: Options,
/* private fields */
}
blob
only.Expand description
A conversion pipeline to take an object or path from what’s stored in git
to what can be diffed, while
following the guidance of git-attributes at the respective path to learn if diffing should happen or if
the content is considered binary.
There are two different conversion flows, where the target of the flow is a buffer with diffable content:
worktree on disk
->text conversion
object
->worktree-filters
->text conversion
Fields§
§roots: WorktreeRoots
A way to read data directly from the worktree.
worktree_filter: Pipeline
A pipeline to convert objects from what’s stored in git
to its worktree version.
options: Options
Options affecting the way we read files.
Implementations§
source§impl Pipeline
impl Pipeline
Lifecycle
sourcepub fn new(
roots: WorktreeRoots,
worktree_filter: Pipeline,
drivers: Vec<Driver>,
options: Options,
) -> Self
pub fn new( roots: WorktreeRoots, worktree_filter: Pipeline, drivers: Vec<Driver>, options: Options, ) -> Self
Create a new instance of a pipeline which produces blobs suitable for diffing. roots
allow to read worktree files directly, otherwise
worktree_filter
is used to transform object database data directly. drivers
further configure individual paths.
options
are used to further configure the way we act..
source§impl Pipeline
impl Pipeline
Conversion
sourcepub fn convert_to_diffable(
&mut self,
id: &oid,
mode: EntryKind,
rela_path: &BStr,
kind: ResourceKind,
attributes: &mut dyn FnMut(&BStr, &mut Outcome),
objects: &dyn FindObjectOrHeader,
convert: Mode,
out: &mut Vec<u8>,
) -> Result<Outcome, Error>
pub fn convert_to_diffable( &mut self, id: &oid, mode: EntryKind, rela_path: &BStr, kind: ResourceKind, attributes: &mut dyn FnMut(&BStr, &mut Outcome), objects: &dyn FindObjectOrHeader, convert: Mode, out: &mut Vec<u8>, ) -> Result<Outcome, Error>
Convert the object at id
, mode
, rela_path
and kind
, providing access to attributes
and objects
.
The resulting diff-able data is written into out
, assuming it’s not too large. The returned Outcome
contains information on how to use out
, or if it’s filled at all.
attributes
must be returning the attributes at rela_path
, and objects
must be usable if kind
is
a resource in the object database, i.e. has no worktree root available.
If id
is null or the file in question doesn’t exist in the worktree in case
a root is present, then out
will be left cleared and Outcome::data will be None
.
Note that mode
is trusted, and we will not re-validate that the entry in the worktree actually is of that mode.
Use convert
to control what kind of the resource will be produced.
§About Tempfiles
When querying from the object database and a binary and a binary-to-text is set, a temporary file will be created to serve as input for the converter program, containing the worktree-data that exactly as it would be present in the worktree if checked out.
As these files are ultimately named tempfiles, they will be leaked unless the gix_tempfile is configured with
a signal handler. If they leak, they would remain in the system’s $TMP
directory.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pipeline
impl RefUnwindSafe for Pipeline
impl Send for Pipeline
impl Sync for Pipeline
impl Unpin for Pipeline
impl UnwindSafe for Pipeline
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)