500 on new merge request with 8.1.0 GA
Similar to #3092 (closed) we are seeing 500s on creating new merge requests for one of our projects. The log looks identical to the old issue:
Processing by Projects::MergeRequestsController#new as HTML
Parameters: {"merge_request"=>{"source_branch"=>"[redacted]", "target_branch"=>"master"}, "namespace_id"=>"[redacted]", "project_id"=>"[redacted]"}
Cache digest for app/views/projects/commits/_commit.html.haml: 66d127c265235456d549fb9eaeef83b2
Read fragment views/[redacted]/4b2cbd592f2988d7d540b5c442d9b1e6b/0/66d127c256d549fb9eaeef83b2 (0.2ms)
[...]
Read fragment views/[redacted]/4b2cbd592f2988d7d540b5c442d9b1e6b/0/66d127c256d549fb9eaeef83b2 (0.2ms)
Completed 500 Internal Server Error in 794ms (ActiveRecord: 16.5ms)
ActionView::Template::Error (undefined method `id' for nil:NilClass):
16: .files
17: - diff_files.each_with_index do |diff_file, index|
18: - diff_commit = commit_for_diff(diff_file)
19: - blob = project.repository.blob_for_diff(diff_commit, diff_file)
20: - next unless blob
21:
22: = render 'projects/diffs/file', i: index, project: project,
app/models/repository.rb:315:in `blob_for_diff'
app/views/projects/diffs/_diffs.html.haml:19:in `block in _app_views_projects_diffs__diffs_html_haml__3688715310924323352_122181500'
app/views/projects/diffs/_diffs.html.haml:17:in `each'
app/views/projects/diffs/_diffs.html.haml:17:in `each_with_index'
app/views/projects/diffs/_diffs.html.haml:17:in `_app_views_projects_diffs__diffs_html_haml__3688715310924323352_122181500'
app/views/projects/merge_requests/_new_submit.html.haml:37:in `_app_views_projects_merge_requests__new_submit_html_haml___565928039244147638_126758240'
app/views/projects/merge_requests/new.html.haml:5:in `_app_views_projects_merge_requests_new_html_haml___414747619380794036_126891240'
The changes in the branch to be merged are rather large, I could not reproduce it with a bunch of trivial tests.