gix_merge::blob

Struct Pipeline

Source
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.

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

Lifecycle

Source

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.

Source§

impl Pipeline

This impl block contains no items.

Access

Source§

impl Pipeline

Conversion

Source

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.

Trait Implementations§

Source§

impl Clone for Pipeline

Source§

fn clone(&self) -> Pipeline

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.