Repository navigation
feat: continue, skip or abort a stopped merge, rebase, cherry-pick or revert, and resolve conflicted files by side - #19
Merged
Merged
Conversation
… revert, and resolve conflicted files by side
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
The first part of the roadmap item Conflicts. When a merge, rebase, cherry-pick or revert stops half way, GitCraft now says so and offers the way on:
Merge in progress, with the message of the commit it will make) and counts the conflicted files. Continue is enabled once every conflict is resolved, Skip leaves out the commit it stopped at (not for a merge, which has none), Abort goes back to where it started. It shows up for operations started on the command line too, through the live refresh.git restore --source --staged --worktree, which resolves it in one step. When that side deleted the file they delete it withgit rminstead; the tooltip says which of the two a button does.How it works:
Repo::underwayreads what is in progress from the files git leaves in the git directory (gitoxide'sstate()), plus the first line ofMERGE_MSG. It also says which commit is "theirs":MERGE_HEAD,REBASE_HEAD,CHERRY_PICK_HEAD, or the parent ofREVERT_HEADfor a revert.Change::Conflictednow says whether ours and theirs still have the file, read from the stage modes ingit status --porcelain=v2(000000means none).Restore,Remove, andContinue,SkipandAbortwith the command they carry on.Still to come (part 2, next in the roadmap): a three-way view to resolve a file conflict by conflict. Until then, clicking a conflicted file does not open a diff, because
git diffshows conflicts in a combined format the diff view does not read yet.How it is tested
Core
resolve_conflicts_and_continue_a_merge: a merge with a content conflict and a modify/delete conflict; what is under way and its message; the conflicted files with which side has them; nothing to undo half way; Continue fails while conflicts remain; take theirs for one file, delete the other as ours did, Continue makes the merge commit.Core
skip_abort_and_continue_a_rebase_a_cherry_pick_and_a_revert: the sides turn around in a rebase (the file deleted by the commit coming in), Skip leaves out the commit; Abort puts a cherry-pick back; for a revert, theirs is the commit before the reverted one, and Continue makes the revert commit.App:
take_their_side_of_a_conflict_and_continue_the_merge(bar, count, Continue disabled, no Skip for a merge),mark_a_conflict_resolved_and_continue_the_rebase(edit the file, Mark resolved, Continue) andabort_a_cherry_pick_that_stopped_at_a_conflict.Status parser: a deleted-by-us record, and a cut-off
urecord is rejected.Tried in the app on Linux: a merge with a content and a modify/delete conflict resolved with Theirs and Ours (deleting the file) and continued; a rebase started on the command line shows up by itself with Skip, and Abort puts the branch back.
No change to the history benchmarks: reading what is in progress costs a few file checks per reload.
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)