detect conflicts in background when previewing rebase #7445
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.
Overview
Closes #6960
Description
This PR adds a feature-flag to test whether the commits to be reapplied as part of the rebase will apply cleanly, and report if that isn't the case - this is an indication there will be conflicts to resolve. There's a bunch of work hardening, polishing and testing still to go but I thought I'd open this up early to share how this solution works.
First, what problems were there to address:
I've settled on a workflow here that uses Git worktrees, which we don't currently support in the app. That's fine, because all of this is internal currently.
I settled on this because it addresses the second two items on that previous list:
git worktree add
shares the same.git
directory from the main worktree, so we don't need to reclone the repository,HEAD
commit to another branch (or use as a detached HEAD) and the index/working directory state is kept separate to the main worktreeWith a worktree for us to maniplate and test independent of the main repository, the rest of the flow becomes pretty straightforward:
git format-patch
to generate the patch series that the rebase will perform and emit this tostdout
git apply
with the patch series against the base branch to see if it can be applied cleanlyReview Plan
As this PR touches a few areas, I'm going to break them up into a series PRs to make reviews more focused. The tentative plan:
OnDiskRepository
that is implemented byRepository
andWorkTree
- introduce OnDiskRepository type to support using worktrees in Git operations #7819TODO
Release notes
Notes: rebase flow will now warn the user if conflicts are expected