diff options
author | Jacob Vosmaer (GitLab) <jacob@gitlab.com> | 2018-01-24 14:59:13 +0000 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2018-01-25 11:03:29 +0100 |
commit | 7363aa0b9d81da6075acc3ed7be0881faff10b49 (patch) | |
tree | be248aebec88a3f48dc1f1f1338b768ed55e1e61 /lib/gitlab/git | |
parent | dcb79741a170eaf673237bb2becbf6fb742a8bfd (diff) | |
download | gitlab-ce-7363aa0b9d81da6075acc3ed7be0881faff10b49.tar.gz |
Revert "Merge branch 'remove-rugged-walk' into 'master'"revert-430b3f0e
This reverts merge request !16525
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r-- | lib/gitlab/git/repository.rb | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index d7c712e75c5..ee75c5e963c 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -490,7 +490,11 @@ module Gitlab return [] end - log_by_shell(sha, options) + if log_using_shell?(options) + log_by_shell(sha, options) + else + log_by_walk(sha, options) + end end def count_commits(options) @@ -1517,6 +1521,27 @@ module Gitlab end end + def log_using_shell?(options) + options[:path].present? || + options[:disable_walk] || + options[:skip_merges] || + options[:after] || + options[:before] + end + + def log_by_walk(sha, options) + walk_options = { + show: sha, + sort: Rugged::SORT_NONE, + limit: options[:limit], + offset: options[:offset] + } + Rugged::Walker.walk(rugged, walk_options).to_a + end + + # Gitaly note: JV: although #log_by_shell shells out to Git I think the + # complexity is such that we should migrate it as Ruby before trying to + # do it in Go. def log_by_shell(sha, options) limit = options[:limit].to_i offset = options[:offset].to_i |