Merge head commit set as last_commit in merge request webhook data
Summary
In this RFH gitlab-com/request-for-help#3510, a customer reported that a merge request webhook is publishing merge_head diff commits. This should not be the case, as merge_head diffs are used internally to generate diffs against the current head of the branch we branched off from.
On investigating, we found a method override that allows lookups for the latest diffs, i.e latest_merge_request_diff that does not filter for regular diffs only (merge_head diffs have an explicitly defined method to fetch them).
On further exploration, we realized there is currently no way that the latest_merge_request_diff can be set to a merge_head_diff, so the absence of the filter on the override does not cause merge_head diffs to be fetched
Example Project
What is the current bug behavior?
webhook last_commit entry has a merge_head diff commit entry
What is the expected correct behavior?
webhook last_commit entry only has regular diff commit entry
Results of GitLab environment info
Possible fixes
- TBD