Skip to content

removed the #ensure_ref_fetched from all controllers

Removed the ref_fetched column from MergeRequest.

I refactored the code to remove all the calls that were done in controllers that would create a ref (hence need a gitaly/db call)

I also renamed the following methods to reflect the side-effect they cause:

  - MergeRequest#fetch_ref -> #fetch_ref!
  - Gitlab::Git::Repository#fetch_source_branch -> #fetch_source_branch!

Like @godfat mentionned in #36061 (closed), these methods also write to the current repository, so I feel a bang method is more appropriate.

Database Checklist

Migration output

== 20171101134435 RemoveRefFetchedFromMergeRequests: migrating ================
-- remove_column(:merge_requests, :ref_fetched)
   -> 0.0172s
== 20171101134435 RemoveRefFetchedFromMergeRequests: migrated (0.0176s) =======

When adding migrations:

  • Updated db/schema.rb
  • Added the output of the migration(s) to the MR body
  • Added the execution time of the migration(s) to the MR body
  • Added tests for the migration in spec/migrations if necessary (e.g. when migrating data)
  • Made sure the migration won't interfere with a running GitLab cluster, for example by disabling transactions for long running migrations

When removing columns, tables, indexes or other structures:

  • Removed these in a post-deployment migration
  • Made sure the application no longer uses (or ignores) these structures

General Checklist

Relevant issue

Closes #36061 (closed)

Merge request reports