Remaining Grit::Commit(s) in older merge_request_diffs

gitlab-ce omnibus: 8.12.1, converted from source install around gitlab 7.

tl;dr: I have unconverted Grit commit lists in old merge_request_diffs rows. Is there an easy way to convert them to the newer hash format? Perhaps re-running an old migration?

The build page for new merge requests for one of our older projects was throwing an http 500 error on load. Inspecting the logs I found “RuntimeError (Invalid raw commit type: Commit)” coming from app/models/me rge_request_diff.rb:178.

RuntimeError (Invalid raw commit type: Commit):
  /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/gitlab_git-10.6.6/lib/gitlab_git/commit.rb:147:in `initialize'
  /opt/gitlab/embedded/service/gitlab-rails/app/models/merge_request_diff.rb:178:in `new'
  /opt/gitlab/embedded/service/gitlab-rails/app/models/merge_request_diff.rb:178:in `block in load_commits'
  /opt/gitlab/embedded/service/gitlab-rails/app/models/merge_request_diff.rb:178:in `map'
  /opt/gitlab/embedded/service/gitlab-rails/app/models/merge_request_diff.rb:178:in `load_commits'
  /opt/gitlab/embedded/service/gitlab-rails/app/models/merge_request_diff.rb:90:in `commits'
  /opt/gitlab/embedded/service/gitlab-rails/app/models/merge_request_diff.rb:99:in `last_commit'
  /opt/gitlab/embedded/service/gitlab-rails/app/models/merge_request_diff.rb:59:in `head_commit_sha'
  /opt/gitlab/embedded/service/gitlab-rails/app/models/merge_request_diff.rb:119:in `head_commit'

After poking around awhile I found that some of our older merge requests were never converted from Grit. About 480 of them. I patched merge_request_diff.rb to skip those and everything loaded fine.

--- merge_request_diff.rb.orig  2016-09-28 17:35:55.728204457 -0700
+++ merge_request_diff.rb       2016-09-28 22:00:15.817244992 -0700
@@ -175,7 +175,7 @@

   def load_commits(array)
- { |hash|, merge_request.source_project) }
+ { |hash| hash.is_a?(Commit) ? nil :, merge_request.source_project) }.compact

   # Load all commits related to current merge request diff from repo

Is there a way to fix this permanently? Is there an old migration that I need to re-run? Would it be reasonable to script out a conversion? Unforutately I am not a ruby programmer and don’t have much experience
with rails. I wouldn’t know how to run the script in the correct rails environment to load all the classes, etc.