Imported branches generate a 500 error upon Merge
Summary
Primary GL Admin is working through their SCM migration process. They will be importing several branches from the old SCM system into GL. They understand that git will see these as not having a common ancestor, but git does support the merge with –allow-unrelated-histories. When they create a merge request in GL and then attempt to view the merge request, they receive a 500 error with this message log content pasted below.
Do they need to perform these initial merges from git directly? Or, is there a path using GitLab? Or is this a bug?
What is the current bug behavior?
500 error
What is the expected correct behavior?
Branch successfully merged.
Relevant logs and/or screenshots
Completed 200 OK in 247ms (Views: 158.9ms | ActiveRecord: 16.5ms)
Started GET "/calheers_poc/lightweight_archshared/merge_requests/3" for 10.128.46.251 at 2017-08-29 08:34:59 -0700
Processing by Projects::MergeRequestsController#show as HTML
Parameters: {"namespace_id"=>"calheers_poc", "project_id"=>"lightweight_archshared", "id"=>"3"}
Completed 500 Internal Server Error in 244ms (ActiveRecord: 19.8ms)
ActionView::Template::Error (invalid filemode for stage 2 entry):
42:
43: = render "projects/merge_requests/widget/show.html.haml"
44:
45: - if @merge_request.source_branch_exists? && @merge_request.mergeable? && @merge_request.can_be_merged_by?(current_user)
46: .merge-manually.light.prepend-top-default
47: You can also accept this merge request manually using the
48: = succeed '.' do
app/models/repository.rb:833:in `merge_commits'
app/models/repository.rb:833:in `can_be_merged?'
app/models/merge_request.rb:417:in `check_if_can_be_merged'
app/models/merge_request.rb:449:in `mergeable?'
app/views/projects/merge_requests/_show.html.haml:45:in `_app_views_projects_merge_requests__show_html_haml___1527485003756424375_70055965545620'
app/views/projects/merge_requests/show.html.haml:1:in `_app_views_projects_merge_requests_show_html_haml___1801860307909436548_70055977866300'
lib/gitlab/middleware/multipart.rb:93:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
lib/gitlab/etag_caching/middleware.rb:10:in `call'
lib/gitlab/middleware/readonly_geo.rb:30:in `call'
lib/gitlab/request_context.rb:18:in `call'
Possible fixes
From @stanhu - This looks like a bug somewhere in GitLab. That error message may be coming from Rugged/libgit2:
https://github.com/libgit2/libgit2/blob/master/src/index.c#L1747