pub struct Pipeline {
pub roots: WorktreeRoots,
pub filter: Pipeline,
pub options: Options,
/* private fields */
}
Expand description
A conversion pipeline to take an object or path from what’s stored in Git to what can be merged, while following the guidance of git-attributes at the respective path to learn how the merge should be performed.
Depending on the source, different conversions are performed:
worktree on disk
->object for storage in git
object
->possibly renormalized object
- Renormalization means that the
object
is converted to what would be checked out into the work-tree, just to turn it back into an object.
- Renormalization means that the
Fields§
§roots: WorktreeRoots
A way to read data directly from the worktree.
filter: Pipeline
A pipeline to convert objects from the worktree to Git, and also from Git to the worktree, and back to Git.
options: Options
Options affecting the way we read files.
Implementations§
Source§impl Pipeline
impl Pipeline
Lifecycle
Sourcepub fn new(
roots: WorktreeRoots,
worktree_filter: Pipeline,
options: Options,
) -> Self
pub fn new( roots: WorktreeRoots, worktree_filter: Pipeline, options: Options, ) -> Self
Create a new instance of a pipeline which produces blobs suitable for merging.
roots
allow to read worktree files directly, and worktree_filter
is used
to transform object database data directly.
options
are used to further configure the way we act.
impl Pipeline
Access
Source§impl Pipeline
impl Pipeline
Conversion
Sourcepub fn convert_to_mergeable(
&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<Option<Data>, Error>
pub fn convert_to_mergeable( &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<Option<Data>, Error>
Convert the object at id
, mode
, rela_path
and kind
, providing access to attributes
and objects
.
The resulting merge-able data is written into out
, if it’s not too large.
The returned Data
contains information on how to use out
, which will be cleared if it is None
, indicating
that no object was found at the location on disk - it’s always an error to provide an object ID that doesn’t exist
in the object database.
attributes
must be returning the attributes at rela_path
and is used for obtaining worktree filter settings,
and objects
must be usable if kind
is a resource in the object database,
i.e. if no worktree root is available. It’s notable that if a worktree root is present for kind
,
then a rela_path
is used to access it on disk.
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 the output data will be None
.
This is useful to simplify the calling code as empty buffers signal that nothing is there.
Note that mode
is trusted, and we will not re-validate that the entry in the worktree actually is of that mode.
Only blobs are allowed.
Use convert
to control what kind of the resource will be produced.