summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-12-19 16:23:00 +0000
committerRobert Speicher <robert@gitlab.com>2017-12-19 16:23:00 +0000
commitac22576d80b6d043c4991ad39172976566465693 (patch)
tree06b4041a313cfabab35373c765cec56566000cb0 /app/models/repository.rb
parent4e60b4f1cdfa7dc3524d17bf313d348758950ecf (diff)
parentc6edae38870a4228e3b964d647b9ef588df11f27 (diff)
downloadgitlab-ce-ac22576d80b6d043c4991ad39172976566465693.tar.gz
Merge branch 'zj-gitaly-pipelines-n-1' into 'master'
Improve performance of Pipelines#index.json See merge request gitlab-org/gitlab-ce!14846
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 4ec8ec9c8b2..387428d90a6 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -118,6 +118,18 @@ class Repository
@commit_cache[oid] = find_commit(oid)
end
+ def commits_by(oids:)
+ return [] unless oids.present?
+
+ commits = Gitlab::Git::Commit.batch_by_oid(raw_repository, oids)
+
+ if commits.present?
+ Commit.decorate(commits, @project)
+ else
+ []
+ end
+ end
+
def commits(ref, path: nil, limit: nil, offset: nil, skip_merges: false, after: nil, before: nil)
options = {
repo: raw_repository,