-
Notifications
You must be signed in to change notification settings - Fork 136
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
Merge instead of rebase #72
Comments
It should be possible, but I'd need to understand how this would work. So, assuming you set the "Merge request settings" for your project in gitlab to "Merge commit" (instead of "Fast-forward merge" or "Merge commit with semi-linear history"), what do you expect to happen when a request is assigned to the marge user? |
I may miss some details but isn't the result of a merge fast-forwardable? Considering we want to merge the MR |
Just to be sure I understand correctly, what would be your main goal here?
|
The goal is the 2nd. To answer your first question, I'd expect marge to just use I'll test the bot against some MR with "rebase" replaced with "merge" in the Line 62 in d5e588c
As I said, merging the MR should be a fast-forward so I don't really see why it wouldn't work. |
Assuming git considers this a fast-forward operation (I didn't try it, but sounds sensible), afaics it should work. A small issue is the following scenario:
This means that by the time the branch is merged to master, you will have a merge-commit for each failed merge attempt, and this is probably not what you want? One could have marge undo the push if the request can't be merged, I guess. Does this make sense? |
Yes it totally does. I don't mind the failed merge commits and I don't think we can really avoid them. What if merging I'm not used to rebase-based workflow in git so I don't know how to handle these history rewriting cleanly. |
As far as I can see, your proposal looks sensible. I'm more used to a rebase-based workflow so I don't have good intuitions on the ergonomics of this, but from what you say, it should be fine. The part that probably won't work is adding commit trailers like "Tested by:", but it would be a matter of rejecting that combination of flags. Do you want to give it a go at adding a flag to use "merge" instead of "rebase"? |
Yes I'll try to submit a PR implementing this. I've already spent the day at work running a patched marge-bot using merge instead of rebase in the I don't get your point about commit trailers though. Since we create a new commit when doing Do you have any recommendations regarding the actual implementation? I'd like to avoid too much duplication between the rebase and merge code paths. |
Re the trailers: the idea of the "Tested-by" trailer is that you can know that the particular commit that contains this trailer was run against CI and passed. You could attach the "Tested-by" trailer to the merge-commit you produce, but it would be meaningless since you don't know at that point whether CI will pass. For the rebase-workflow, we add tentatively the "Tested-by" trailer to the head commit and remove it from all other commits in the branch, so effectively, by the time the branch makes it to Re implementation, I'd try to keep it simple, at least initially. In |
Re the trailers: Oh that makes sense. Since as we previously said we keep the previous potentially failed merge commits, we can't use the same technique you describe (optimistically setting the Re implementation: I agree on the direction you're suggesting especially if we end up having really different behavior. The thing is With that, I'll start hacking on the PR. Thank you for all this help! |
I've merged this change, I think it is a first step. I still suspect for this to be truly useful, we'd need to remove merge commits to recover from attempted merge attempts that failed to pass CI, etc. I will open a separate issue for that and people actually trying this feature can comment on it. |
Would it be possible to add an option to use a git merge instead of a git rebase ?
The text was updated successfully, but these errors were encountered: