fix(branch onto): rebase loop on conflicts #582
Merged
+178
−19
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.
Fixes an issue reported by a user where the following steps cause
a rebase conflict loop:
gs rebase continue
The cause of this issue is this:
when the operation to move A onto B runs into a conflict,
git-spice's internal state is not updated to reflect the new base
(this is correct and desirable).
However, when the operation is re-run after resolving the conflict,
it attempts to replay commits
Base..A
onto B,except
Base..B
overlaps with that range with the new state of the repository.This forces the user to resolve a bunch of conflicts from replaying those operations,
but the
rebase --continue
does not ever succeed, and the state is never updated.so it keeps retrying the same commits on top of B over and over again.
The fix for this is fairly straightforward:
if B is in the Base..A commit range, rebase only B..A instead of Base..A.