pub struct Platform {
pub filter: Pipeline,
pub attr_stack: Stack,
pub options: Options,
pub filter_mode: Mode,
/* private fields */
}
Expand description
A utility for gathering and processing all state necessary to perform a three-way merge.
It can re-use buffers if all three parts of participating in the merge are set repeatedly.
Fields§
§filter: Pipeline
A way to convert objects into a diff-able format.
attr_stack: Stack
A way to access .gitattributes
options: Options
Further configuration that affects the merge.
filter_mode: Mode
The way we convert resources into mergeable states.
Implementations§
Source§impl Platform
impl Platform
Preparation
Sourcepub fn set_resource(
&mut self,
id: ObjectId,
mode: EntryKind,
rela_path: &BStr,
kind: ResourceKind,
objects: &impl FindObjectOrHeader,
) -> Result<(), Error>
pub fn set_resource( &mut self, id: ObjectId, mode: EntryKind, rela_path: &BStr, kind: ResourceKind, objects: &impl FindObjectOrHeader, ) -> Result<(), Error>
Store enough information about a resource to eventually use it in a merge, where…
id
is the hash of the resource. If it is null, it should either be a resource in the worktree, or it’s considered a non-existing, deleted object. If anid
is known, as the hash of the object as (would) be stored ingit
, then it should be provided for completeness. Note that it’s not expected to be inobjects
ifrela_path
is set and a worktree-root is available forkind
.mode
is the kind of object (only blobs and executables are allowed)rela_path
is the relative path as seen from the (work)tree root.kind
identifies the side of the merge this resource will be used for.objects
provides access to the object database in case the resource can’t be read from a worktree.
Source§impl Platform
impl Platform
Preparation
Sourcepub fn prepare_merge(
&mut self,
objects: &impl Find,
options: Options,
) -> Result<PlatformRef<'_>, Error>
pub fn prepare_merge( &mut self, objects: &impl Find, options: Options, ) -> Result<PlatformRef<'_>, Error>
Prepare all state needed for performing a merge, using all previously set resources.
objects
is used to possibly lookup attribute files when obtaining merge-related attributes.
options
are to be used when merging later, and they may be altered to implement correct binary merges
in the present of virtual merge bases.
Note that no additional validation is performed here to facilitate inspection, which means that resource buffers might still be too large to be merged, preventing a successful merge at a later time.
Source§impl Platform
impl Platform
Lifecycle
Sourcepub fn new(
filter: Pipeline,
filter_mode: Mode,
attr_stack: Stack,
drivers: Vec<Driver>,
options: Options,
) -> Self
pub fn new( filter: Pipeline, filter_mode: Mode, attr_stack: Stack, drivers: Vec<Driver>, options: Options, ) -> Self
Create a new instance with a way to filter
data from the object database and turn it into something that is merge-able.
filter_mode
decides how to do that specifically.
Use attr_stack
to access attributes pertaining worktree filters and merge settings.
drivers
are the list of available merge drivers that individual paths can refer to by means of git attributes.
options
further configure the operation.