-
Notifications
You must be signed in to change notification settings - Fork 2
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] Add rebase on top of default branch #15
base: master
Are you sure you want to change the base?
Conversation
Problem: Currently when there are human commits in update branch, update bot reports an error. Solution: Rebase current changes in remote update branch on top of remote default branch if possible. Otherwise report an error.
I'm not entirely sure I understand how this addresses the discussion in #10, if I am understanding correctly this is almost the same logic as what we removed, and the issue with that was that if there were conflicts it would stop working, but with
iirc you do this by fixing the conflicts, then |
Yes
Situation:
The difference is in result after "Bot runs one more time" How worked before:
How works now:
|
What state does this leave the local repository with if the rebase fails? Does it cleanly check out some sensible branch? |
Oh, no, it stays in something strange like detached HEAD or so. I try to fix this and my idea is to:
I'm trying to do that but I can't find the list of operations with
but it either didn't move to default branch or left uncommited changes. Perhaps if I understand the logic here, it will help. Could you please explain what is happening here maybe in git operations? |
Problem: bot doesn't checkout to a sensible branch after a rebase fail. Solution: checkout to default branch. Note: currently an error "rebase patch already applied" occurs. Needs to be fixed.
I worked out a way to checkout to the default branch. Now some bugs need to be fixed |
Ok the bug that I was facing was found accidentally and it won't appear in normal usage. But I will describe it here just in case: If the last commit in the main branch and in the automatic-update branch are identical (including commit messages), then during the rebase this error occurrs:
|
So currently the bot checks out to the default branch in case of any rebase failure. |
@sancho20021 do you think I should merge it? |
Not sure @cab404
Bad:
Maybe I or @balsoft should remember and comment the part of the code about the rebase. What do you think? |
I think the code reads relatively well for a rebase it creates some sort of rebase object and then for each commit in the rebase it
finally, it finishes the rebase if any of those fail it hard resets all changes If that is the case then I don't see a need for further documentation. |
Changes look ok for me as well |
I have some questions:
|
Also, if we ignore human commits in the update branch for a moment, I don't think we actually need to do the rebase proper? The update logic goes like this currently:
(the actual logic is a little more convoluted, but this is the gist of it). So there's a hole in this logic: the update branch is only updated to the default branch (via soft-reset) in (4), but not in (5). The tricky bit is that we don't want to unnecessarily force-push, hence we'll need to check whether there are new commits in the default branch. I think we just need to check graph_ahead_behind to decide. |
That indeed sounds like a much easier and less error-prone approach. Apparently, the human commits can be cherry-picked on top of the soft-reset branch |
The issue isn't as much in how to put human commits into the update branch, although there are many modes of failure for this operation, too, but rather in how to find them properly. And then there's the question of what to do if there are human commits but no bot ones (e.g. because |
Description
Rebase current changes in remote update branch on top
of remote default branch if possible. Otherwise report an error.
I used the version before this commit, but inserted
rebase abort
in case of rebase commit fails.Fixes #10
Some notes:
When I tried to reproduce merge conflicts, the
rebase.commit
operation failed with this error:But the state of the rebase looked like a state when a user needs to resolve conflicts and continue rebasing. So I don't understand why it's marked as unstaged changes.
Way to resolve conflicts
When update-bot fails to rebase, the user (human) can do the rebase by himself, resolve all the conflicts and (force)push. Update-bot will be able to continue working in the existing branch.