summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-11-10 20:57:11 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2017-11-16 16:01:14 +0100
commitab16a6fb34c0f3e4d9afed3332c559868201e606 (patch)
treee878395b0f198b3db1cc014bad02361628f6206e /app/models/repository.rb
parent81e94ce1761b48b73be2a8d71938dfe934921e35 (diff)
downloadgitlab-ce-ab16a6fb34c0f3e4d9afed3332c559868201e606.tar.gz
Optimise getting the pipeline status of commitsci-pipeline-status-query
This adds an optimised way of getting the latest pipeline status for a list of Commit objects (or just a single one).
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 3a89fa9264b..35ee12bdfa1 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -132,7 +132,8 @@ class Repository
commits = Gitlab::Git::Commit.where(options)
commits = Commit.decorate(commits, @project) if commits.present?
- commits
+
+ CommitCollection.new(project, commits, ref)
end
def commits_between(from, to)
@@ -148,11 +149,14 @@ class Repository
end
raw_repository.gitaly_migrate(:commits_by_message) do |is_enabled|
- if is_enabled
- find_commits_by_message_by_gitaly(query, ref, path, limit, offset)
- else
- find_commits_by_message_by_shelling_out(query, ref, path, limit, offset)
- end
+ commits =
+ if is_enabled
+ find_commits_by_message_by_gitaly(query, ref, path, limit, offset)
+ else
+ find_commits_by_message_by_shelling_out(query, ref, path, limit, offset)
+ end
+
+ CommitCollection.new(project, commits, ref)
end
end