Skip to content

Comments made on individual commits do not persist on merge request after history is changed

Summary

It seems gitlab recently added the capability to comment on a commit as a whole (rather than just the MR or a line of the diff). This has been very helpful for my team's workflow, but as I've been using the feature I've discovered that the commits don't stay associated with the MR they originated from.

Steps to reproduce

  • Open an MR
  • Make a comment on some commit that makes up the MR
    • Click commit name under "commits" tab
    • Click through the commit hash
    • Scroll down to the bottom of the diff
    • Enter a comment into the field
  • Return to the MR page
    • Observe that the comment is shown in the MR's discussion
  • Force push to the branch, changing the commented commit
  • Return to the MR page
    • Observe that the comment is now not shown in the MR's discussion

Example Project

What is the current bug behavior?

When a merge request's history changes, comments on commits that used to be part of that MR are no longer associated.

What is the expected correct behavior?

When a merge request's history changes, comments that are part of that MR's discussion thread should still be associated, though marked as outdated. This would match the behavior of ordinary diff comments, which are marked as on "the diff" or "an old version of the diff," depending on if the line in question has been changed.

Relevant logs and/or screenshots

Before force-pushing to feature branch:

commit_comment_present

After force-pushing to feature branch:

commit_comment_missing

Output of checks

This bug happens on GitLab.com.

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:env:info)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Edited by Austin Glaser