Skip to content
Snippets Groups Projects
Commit 2a9c2fec authored by Stan Hu's avatar Stan Hu
Browse files

Optimize creation of commit API by using Repository#commit instead of Repository#commits

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
parent b5b4054d
No related branches found
No related tags found
No related merge requests found
---
title: Optimize creation of commit API by using Repository#commit instead of Repository#commits
merge_request:
author:
Loading
Loading
@@ -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)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment