Cannot add comment to line next to a "no newline" entry
Summary
When reviewing Merge Requests in Side-by-Side Compare Changes view, some of the original files may have had missing newlines at EOF. The new changes may show content next to these changes but it is not possible to add a comment on that new line.
Issue does not occur when using the Inline Compare Changes view.
Steps to reproduce
- Add a file with 6 lines of content and no newline at EOF
- Create an MR for that file that 3 new lines of content to the file
- Open MR under "Changes", set Compare Changes view to Side-by-Side
- Go to line 6 for the updated changes and try to add comment
Example Project
Project and MR demonstrates the issue: wsiddall/gitlab-no-newline-comment-bug!1 (diffs)
What is the current bug behavior?
The comment icon does not appear in the viewer
What is the expected correct behavior?
Even if you cannot comment on a "no newline" (although I think you should to tell the contributor these should be resolved), the line next to the "no newline" should still allow comments as we need to comment on that content directly.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com /label reproduced 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)