Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

octopus-merge (part 3.5: gix-api and CLI) #1611

Merged
merged 7 commits into from
Sep 30, 2024
Merged

octopus-merge (part 3.5: gix-api and CLI) #1611

merged 7 commits into from
Sep 30, 2024

Conversation

Byron
Copy link
Member

@Byron Byron commented Sep 30, 2024

Follow-up of #1585 .

Tasks

  • blob configuration keys
  • gix-API to merge three files
  • gix merge-file

Next PR / Outscoped

  • textconv with context, see this gist for details.
    • There seem to be different 'tiers' of tools, some don't get GIT_DIR set, others do.
    • It also seems that diff-programs get too much context right now, but that depends on how much is passed to them by the caller as gix-command::Context.
  • How to model virtual-merge-bases? Can be none or many, user should have control over how this is done.
    • there is tests for that in diff3-conflict-markers
  • Understand how conflicts are currently handled in GitButler.
  • Actual tree-based merging
    • See also, all the merge options
    • Submodule merges are also possible! Maybe outscope it though! libgit2 also doesn't try it.
    • diff3-conflict-markers.sh - be sure to capture the 'empty tree' label , but also other special cases
  • Make blob-merge based conflict handling possible in the tree merge from gix at least.

Research

Everything is about MergeORT.

  • it uses an empty tree if there is no merge-base - we must allow the same.
  • it allows for multiple merge-bases, creating a virtual one by merging all merge-bases together using the same algorithm, recursively.
  • merges can have conflicts without a individual files being involved, for instance when directory renames clash
  • Must make sure that possible types of conflicts are properly communicated, to not degenerate information
  • It puts conflict-markers in the blobs of the result tree, with annotations to provide additional context
  • Need resolution configuration, see git2::MergeOptions.
  • data stored by path, and is interned in the map to allow pointer-based comparisons
    • merge-info with everything one needs to know, also related to renames
    • or conflict information
    • it uses a memory-pool/arena to get memory for many paths all at once (and also release it like that)
  • paths start out as conflicted, and then can later be changed to non-conflicting if a content-based merged succeeded.
    • If it remains conflicts, the meta-data is used to produce an 'as merged as possible' version with conflict markers that can be checked out to the working tree.
  • hunks can partially overlap, but can also be resolved line-by line to some extend.

That way it can be modified after it was initialized from Git configuration.
@Byron Byron marked this pull request as ready for review September 30, 2024 19:42
@Byron Byron enabled auto-merge September 30, 2024 20:04
@Byron Byron merged commit 5ffccd2 into main Sep 30, 2024
16 checks passed
@Byron Byron deleted the merge branch October 1, 2024 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant