JIRA Integration "solved by commit" is posted with wrong commit (squashed commits)

Summary

When option "squash commits" is used in a merge request, the wrong solved by commit is sent to JIRA integration. Instead of the squashed commit thast is merged into master, the lastet commit to the merge request is used as "solved". But this commit only contains a part of the changes made to master.

Steps to reproduce

  1. Integrate project with Jira
  2. In project settings in Gitlab select "Fast-forward merge" as merge method
  3. Create a new branch e.g. "feature" and make a few commits
  4. Create a merge request from branch feature into master and link it to JIRA with project key (e.g. AB-34)
  5. Select "Squash commits when merge request is accepted" and submit the merge request

Go to JIRA and lookup the issue AB-34. The merge request is linked correctly. When you click on "solved by commit" in JIRA, then you will see the latest commit to feature. Correct would be the squashed commit to master.

What is the current bug behavior?

In JIRA the link "solved by commit" is pointing to the latest commit to branch e.g. "feature" that was squashed and merged into master. This is only a part of the changes that were merged into master (option squash commits!)

What is the expected correct behavior?

In JIRA the link "solved by commit" should point to all changes that were merged from the branch feature into master.

Output of checks

This bug happens on GitLab.com

Possible fixes

Check if the merge request has the option 'squash commits' in JIRA Service and return the squashed commit and not the head.

Edited by Christian Elbe