[6.1] Comments on compressed diffs disappear and raise errors
Created by: abdlrhm
**Summary:**If a comment is attached to a line of a compressed diff (after being unhidden) it will disppear after a page refresh. If the associated branch was used for a merge request, all comments on the merge request (with or without diffs) will disappear and an exception will be raised in production.log (Attached at the end of this report) This was tested on the 6.1 (stable) branch.
Steps to reproduce:
- Create a new project
- Create branches 'master' and 'test', Push a file with around 2k of lines to 'test',
- View the commit on Gitlab. It will show "Diff compresses" for this file.
- Unhide the compressed diff and add a comment.
- Refresh the page (The comment will be gone).
- Create a new merge request 'test' -> 'master' . Make comments on the merge request.
Expected behaviour: Comments will show on the compressed diff after being refreshed and unhidden and comments will show in the Discussion section of the merge request.
Actual behaviour: Comments on the compressed diff and the merge request are gone.
Workarounds I manually remove the 'note' record from the database table. Is there a way to disable compresses diffs altogether?
Checks sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production Checking Environment ... Git configured for git user? ... yes Has python2? ... yes python2 is supported version? ... yes Checking Environment ... Finished Checking GitLab Shell ... GitLab Shell version >= 1.7.1 ? ... OK (1.7.1) Repo base directory exists? ... yes Repo base directory is a symlink? ... no Repo base owned by git:git? ... yes Repo base access is drwxrws---? ... yes update hook up-to-date? ... yes update hooks in repos are links: ... [Redacted. All are 'Ok'] Checking GitLab Shell ... Finished Checking Sidekiq ... Running? ... yes Checking Sidekiq ... Finished Checking GitLab ... Database config exists? ... yes Database is SQLite ... no All migrations up? ... yes GitLab config exists? ... yes GitLab config outdated? ... no Log directory writable? ... yes Tmp directory writable? ... yes Init script exists? ... yes Init script up-to-date? ... yes projects have namespace: ... [Redacted. All are 'yes'] Redis version >= 2.0.0? ... yes Your git bin path is "/usr/bin/git" Git version >= 1.7.10 ? ... yes (1.8.4) Checking GitLab ... Finished
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production System information System: Ubuntu 12.04 Current User: git Using RVM: no Ruby Version: 2.0.0p0 Gem Version: 2.0.0 Bundler Version:1.3.5 Rake Version: 10.1.0
GitLab information Version: 6.1.0 Revision: 82f3446f Directory: /home/git/gitlab DB Adapter: mysql2 URL: [Redacted] HTTP Clone URL: [Redacted] SSH Clone URL: [Redacted] Using LDAP: no Using Omniauth: no
GitLab Shell Version: 1.7.1 Repositories: /home/git/repositories/ Hooks: /home/git/gitlab-shell/hooks/ Git: /usr/bin/git
Relevant Logs
In production.log when viewing the merge request
ActionView::Template::Error (undefined method `deleted_file' for nil:NilClass):
1: - diff = note.diff
2: .header
3: - if diff.deleted_file
4: %span= diff.old_path
5: - else
6: %span= diff.new_path
app/views/projects/notes/_discussion_diff.html.haml:3:in `_app_views_projects_notes__discussion_diff_html_haml__3473501046556030246_70204484052680'
app/views/projects/notes/_discussion.html.haml:41:in `_app_views_projects_notes__discussion_html_haml___1318137321950408769_70204481043480'
app/views/projects/notes/_notes.html.haml:7:in `block in _app_views_projects_notes__notes_html_haml__1023570686050168605_70204481940140'
app/views/projects/notes/_notes.html.haml:2:in `each'
app/views/projects/notes/_notes.html.haml:2:in `_app_views_projects_notes__notes_html_haml__1023570686050168605_70204481940140'
app/views/projects/notes/index.js.haml:2:in `_app_views_projects_notes_index_js_haml__4092311970910500166_70204493509380'
app/controllers/projects/notes_controller.rb:17:in `index'