summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2018-03-06 15:26:57 +0100
committerAhmad Sherif <me@ahmadsherif.com>2018-03-06 15:27:03 +0100
commit37162a5fa64c79f5f05868b4f3a6b8b4776b0182 (patch)
treec6247bb92b4c554197fc5ee6286dafd96c1ee7e4 /lib
parent5e8138aa54492dd3ace42d889ba01f82e8e19c83 (diff)
downloadgitlab-ce-37162a5fa64c79f5f05868b4f3a6b8b4776b0182.tar.gz
Reduce number of FindCommit calls from RefsController#logs_treefix/reduce-number-of-find-commit-for-log-tree
Fixes gitaly#1057 The old code was calling LastCommitForPath to extract a commit ID _then_ call FindCommit to get a commit it already had in the first place!
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git/repository.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 21c79a7a550..e1da45462eb 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1443,12 +1443,12 @@ module Gitlab
end
end
- def last_commit_id_for_path(sha, path)
+ def last_commit_for_path(sha, path)
gitaly_migrate(:last_commit_for_path) do |is_enabled|
if is_enabled
- last_commit_for_path_by_gitaly(sha, path).id
+ last_commit_for_path_by_gitaly(sha, path)
else
- last_commit_id_for_path_by_shelling_out(sha, path)
+ last_commit_for_path_by_rugged(sha, path)
end
end
end
@@ -1896,7 +1896,7 @@ module Gitlab
end
def last_commit_for_path_by_rugged(sha, path)
- sha = last_commit_id_for_path(sha, path)
+ sha = last_commit_id_for_path_by_shelling_out(sha, path)
commit(sha)
end