diff options
Diffstat (limited to 'app/models/commit_collection.rb')
-rw-r--r-- | app/models/commit_collection.rb | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/app/models/commit_collection.rb b/app/models/commit_collection.rb index 52524456439..a9a2e9c81eb 100644 --- a/app/models/commit_collection.rb +++ b/app/models/commit_collection.rb @@ -28,43 +28,10 @@ class CommitCollection def without_merge_commits strong_memoize(:without_merge_commits) do - # `#enrich!` the collection to ensure all commits contain - # the necessary parent data - enrich!.commits.reject(&:merge_commit?) + commits.reject(&:merge_commit?) end end - def unenriched - commits.reject(&:gitaly_commit?) - end - - def fully_enriched? - unenriched.empty? - end - - # Batch load any commits that are not backed by full gitaly data, and - # replace them in the collection. - def enrich! - # A project is needed in order to fetch data from gitaly. Projects - # can be absent from commits in certain rare situations (like when - # viewing a MR of a deleted fork). In these cases, assume that the - # enriched data is not needed. - return self if project.blank? || fully_enriched? - - # Batch load full Commits from the repository - # and map to a Hash of id => Commit - replacements = Hash[unenriched.map do |c| - [c.id, Commit.lazy(project, c.id)] - end.compact] - - # Replace the commits, keeping the same order - @commits = @commits.map do |c| - replacements.fetch(c.id, c) - end - - self - end - # Sets the pipeline status for every commit. # # Setting this status ahead of time removes the need for running a query for |