Open Byron opened 3 weeks ago
@EliahKagan Just as a note in case you'd like to submit a first patch to Git that will definitely be able to land, maybe to warm-up with the mailing-list workflow, then I have something for you.
The attribute-documentation about three-way merges contains a reference to merge.default
which is indeed used in code as well.
However, the git-config documentation doesn't mention it at all.
Implement an octopus merge based on trees, and (mostly) equivalent to
merge-ORT
in Git. The foundation, tree-editing, was implemented in #1566.Related to https://github.com/gitbutlerapp/gitbutler/pull/4793.
Tasks
This PR was re-focussed on blob-based conflict detection and the generation of blob merge-results with conflict markers.
flattenBringmerge
intoplatform
API, similar to how it's done indiff
merge::State
to being able to execute the merge.Pipeline
implementation and testsPlatform
implementation and tests%P
argument for merge-drivers is needed for it to get through to the driver programGIT_REFLOG_ACTION
,GIT_EXEC_PATH
andGIT_PREFIX
can be passedmerge
stylediff3
stylezdiff3
stylediff3-conflict-markers.sh
(some special cases)figure out- skipped in interest of timecommon
case, where single-line changes are merged with the common middle, probably unrelated to the actual diff as zdiff3 and diff3 work.Note that 'union' is also affected by this, which seems detremental- skipped in interest of timemerge-file
(less simplistic input)<<<
lines that the text merge is adding? Probably configurable?gix-diff
.Questions
Next PR / Outscoped
textconv
with context, see this gist for details.GIT_DIR
set, others do.gix-command::Context
.diff3-conflict-markers
libgit2
also doesn't try it.diff3-conflict-markers.sh
- be sure to capture the 'empty tree' label , but also other special casesgix
at least.Research
Everything is about MergeORT.
git2::MergeOptions
.Crates
Mostly for performance optimization, also interesting for handling the index, and the tree::editor types.
Building Blocks for String Interning
yoke
.bumpalo
, but returns an index to the item, can also remove things. Strings aren't really supported though (i.e. variable length slices)String Interining
&str
https://lib.rs/crates/interned- also for&[u8]
- but leaks the data to get pointer comparisonArenaInterner
also for[u8]
Handle Special Cases
Questions
Is
git2::merge_trees()
a trivial merge? Does it handle all the cases of MergeORT?Maybe not, but it definitely handles rename tracking. See these
git2
flags for more information.How does rename-tracking affect a tree-merge?
The first round is done without renames, then there is a second round to find renames, and perform the merge of renamed items.
How is an octopus merge implemented, particularly with Merge ORT?
References