diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-10-01 13:29:47 +0100 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-10-01 13:29:47 +0100 |
commit | a583f137ddc9833796752b9cf8c07077d76078ba (patch) | |
tree | cc92c76a4d29f61a24740e5ab45cd71926677d9c /app/models/repository.rb | |
parent | e8e1a51adddd9d7a504c06ea383cf682493f6a90 (diff) | |
download | gitlab-ce-a583f137ddc9833796752b9cf8c07077d76078ba.tar.gz |
Removes N+1 gitaly rpc call to fetch the last commit for path
Implements list_last_commits_for_tree to communicate with the
ListLastCommitsForTree Gitaly RPC
Bumps the Gitaly server version
Bumps the Gitaly-Proto gem version
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 4fecdb3c1ad..a3a3ce179fc 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -668,6 +668,14 @@ class Repository end end + def list_last_commits_for_tree(sha, path, offset: 0, limit: 25) + commits = raw_repository.list_last_commits_for_tree(sha, path, offset: offset, limit: limit) + + commits.each do |path, commit| + commits[path] = ::Commit.new(commit, @project) + end + end + def last_commit_for_path(sha, path) commit = raw_repository.last_commit_for_path(sha, path) ::Commit.new(commit, @project) if commit |