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: PipelineA way to convert objects into a diff-able format.
attr_stack: StackA way to access .gitattributes
options: OptionsFurther configuration that affects the merge.
filter_mode: ModeThe way we convert resources into mergeable states.
Implementations§
Source§impl Platform
Preparation
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…
idis 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 anidis 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 inobjectsifrela_pathis set and a worktree-root is available forkind.modeis the kind of object (only blobs and executables are allowed)rela_pathis the relative path as seen from the (work)tree root.kindidentifies the side of the merge this resource will be used for.objectsprovides access to the object database in case the resource can’t be read from a worktree.
Source§impl Platform
Preparation
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
Lifecycle
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.