Honor "fixup!" commits in merge requests
When an admin selects "Fast-forward merge" Merge method in Project Settings, a "Rebase merge request" button is present in merge requests where the master (or the branch to which a merge is requested) has changed since submitting the merge request.
When one then pushes further commits to the merge request's source branch which address review comments in a way of doing git commit --fixup <sha>
(e.g. not to mess up previous inline comments made in the diff by a reviewer, and/or to be clear about what is being changed), and then the reviewer chooses to use the "Rebase merge request" button, I would expect the "fixup! ..." commits to be squashed into the commits they are fixing, just like if git rebase --autosquash --interactive master
was run with accepting the proposed TODO list for the rebase. But that is not the case (I just tried on a demo project) - the commits in the source branch are rebased on the latest master, but with the "fixup!" commits treated as completely ordinary commits (i.e. still present).
Proposal
If a merge request contains a fixup!
commit that targets a commit in the feature branch, the merge request interface should handle this according to the merge method in the project settings:
-
Merge commit
- If
Squash and Merge
is enabled, the fixup commit doesn't matter because it'll be squashed away - Else, show a message and a rebase button
- If
-
Merge commit with semi-linear history -
Rebase merge request
button should rebase with--autosquash
support -
Fast forward merge –
Rebase merge request
button should rebase with--autosquash
support