Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#10] Reset to default branch if update branch is behind #29

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

lierdakil
Copy link
Contributor

@lierdakil lierdakil commented Jul 21, 2023

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.

  1. Reset to default branch if update branch is behind

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.

  1. Cherry-pick human commits onto the reset update branch

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.

  • If it isn't, the bot pushes new commits on top of the branch, or
    amends the last commit if it wasn't made by a human and it's not also
    on the default branch.
  • If it is, the update branch is hard-reset to the default one, and any
    human commits are cherry-picked on top.
  • If it doesn't exist, it's initialized to the default branch.

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.

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.
@lierdakil lierdakil requested a review from rvem July 21, 2023 14:47
@rvem
Copy link
Member

rvem commented Jul 24, 2023

As I mentioned elsewhere, simply not touching the auto-update branch isn't unreasonable, just make a separate branch.

Okay, at this point I agree. Seems like the second commit brings additional chaos to the way automatic-update branch is handled.

Perhaps, it's easier to document the fact that human commits shouldn't appear in it

@lierdakil lierdakil changed the title [#10] Cherry-pick human commits [#10] Reset to default branch if update branch is behind Jul 26, 2023
@lierdakil lierdakil force-pushed the lierdakil/#10-cherry-pick-human-commits branch from 2643b85 to eaac4d4 Compare July 26, 2023 14:48
@lierdakil
Copy link
Contributor Author

Okay, since we both seem to be in doubt about the second commit, let's shelve it for the time being, and focus on the first one as it seems rather straightforward.

@lierdakil lierdakil marked this pull request as ready for review July 26, 2023 14:50
@lierdakil lierdakil merged commit 1a03068 into master Jul 26, 2023
@lierdakil lierdakil deleted the lierdakil/#10-cherry-pick-human-commits branch July 26, 2023 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants