Repository navigation
feat: resolve a conflicted file conflict by conflict, with both sides next to each other and the result below - #21
Merged
Conversation
… next to each other and the result below
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Clicking a conflicted file (one both sides changed) now opens it in the centre to resolve conflict by conflict: our side and theirs next to each other with every conflict lined up, and below them the result as it will be saved. For the conflict on screen you take ours, theirs or both (ours first); GitCraft then moves on to the next conflict without a pick. Previous and Next, or a click on a conflict's heading, go to any conflict, and the lists scroll to it. Save and mark resolved writes the result and adds the file once every conflict has a pick; the file then leaves the list and the bar's Continue becomes available.
It reads the conflict markers git wrote into the file, so it works for merges, rebases, cherry-picks and reverts, with
merge.conflictStylemerge,diff3orzdiff3(the common ancestor is left out), and keeps the file's line endings. When the file changes outside GitCraft, it is read again; when its markers are gone (resolved in an editor), the view closes and says to mark it resolved or take a side. A file one side deleted keeps its Ours and Theirs buttons, as before.Roadmap: "Conflicts, part 2".
How it is tested
conflict.rsunit tests: splitting at the markers, thediff3ancestor left out, CRLF and a missing last newline kept, markers outside a conflict or of the wrong length ignored, unbalanced markers rejected, and resolving only once every conflict has a pick.Core test against a real merge with two conflicts: read, resolve with theirs and both, save, continue the merge; a file without markers and a missing file give their own errors.
App tests through the accessibility tree: resolve two conflicts (moving on by itself, going back through a heading, Save disabled until every conflict has a pick), save and continue the merge; and a conflicted file edited outside drops its pick, then closes with an explanation once its markers are gone.
Tried in the app: a merge with two conflicts in a Rust file and a rebase of a 300-line file with three conflicts far apart (the lists scroll to each), saved and continued.
cargo fmt --all,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspacepassIt adds as little code as the change needs, and removes what it makes unnecessary
Nothing in it comes from GitKraken or another closed-source client (see CONTRIBUTING.md)