[#10] Reset to default branch if update branch is behind #29
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.
Problem: if the default branch is updated while an update branch exists,
the update branch won't be automatically rebased.
Solution: in lieu of a proper rebase, which is hard, reset the update
branch to the default, as we'll have to force-push anyway, and there's
not much to rebase if there are no human commits to begin with.
This PR was pivoted somewhat after the discussion, initially it was intended to help with #10, but that makes the logic rather convoluted, so it was deemed ultimately not worth it. Thus, only one relatively uncontroversial change from the first iteration is preserved.
For posterity, the old description:
This consists of two commits, the first one I'm pretty positive about, the second one, not so much. Honestly, I'd rather keep it simple than end up fixing bugs for the next however long. As I mentioned elsewhere, simply not touching the auto-update branch isn't unreasonable, just make a separate branch.
Problem: if the default branch is updated while an update branch exists,
the update branch won't be automatically rebased.
Solution: in lieu of a proper rebase, which is hard, reset the update
branch to the default, as we'll have to force-push anyway, and there's
not much to rebase if there are no human commits to begin with.
Problem: currently, when there are human commits in the update branch,
we just bail. There has to be a more robust strategy.
Solution: complicated. The first decision point is whether the update branch
is behind the default branch.
amends the last commit if it wasn't made by a human and it's not also
on the default branch.
human commits are cherry-picked on top.
This feels like a reasonable balance between force-pushing all the time
and trying to preserve history to an extent. However, it is all rather
convoluted.