summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-07-03 15:46:52 -0700
committerStan Hu <stanhu@gmail.com>2017-07-03 15:48:13 -0700
commit2a9c2fec4efd1b88e2ee8ad87818d8435a97619f (patch)
tree35feed6d2e35dbffbe489da9f38b15fa93d51c43 /lib
parentb5b4054d5882782892d0a860c7e95db9a22bfdec (diff)
downloadgitlab-ce-2a9c2fec4efd1b88e2ee8ad87818d8435a97619f.tar.gz
Optimize creation of commit API by using Repository#commit instead of Repository#commitssh-optimize-project-commit-api
Repository#commits is expensive because it has to use Rugged to walk the Git tree as opposed to doing a direct ref lookup. Improves performance in #34533
Diffstat (limited to 'lib')
-rw-r--r--lib/api/commits.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb
index c6fc17cc391..bcb842b9211 100644
--- a/lib/api/commits.rb
+++ b/lib/api/commits.rb
@@ -67,7 +67,7 @@ module API
result = ::Files::MultiService.new(user_project, current_user, attrs).execute
if result[:status] == :success
- commit_detail = user_project.repository.commits(result[:result], limit: 1).first
+ commit_detail = user_project.repository.commit(result[:result])
present commit_detail, with: Entities::RepoCommitDetail
else
render_api_error!(result[:message], 400)