diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-07 22:06:46 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-07 22:06:46 +0300 |
commit | bc648ae5d225b3b76cc3105681e2f404a5918f85 (patch) | |
tree | 3fa452d63deb31a8612f5d1d6728bdded5fdf9d1 | |
parent | 33bcfbf8e3b78558da62c829e5d1f647e3339a8b (diff) | |
parent | f278e5fb3e272673ca730b773821bc432f81597e (diff) |
Merge branch 'gitlab-git-repository-log-options' into 'master'
Set default options outside the raw_log method
See merge request !13346
-rw-r--r-- | lib/gitlab/git/repository.rb | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 1005a819f95..f6f9d49bf37 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -299,6 +299,21 @@ module Gitlab # # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/446 def log(options) + default_options = { + limit: 10, + offset: 0, + path: nil, + follow: false, + skip_merges: false, + disable_walk: false, + after: nil, + before: nil + } + + options = default_options.merge(options) + options[:limit] ||= 0 + options[:offset] ||= 0 + raw_log(options).map { |c| Commit.decorate(c) } end @@ -712,20 +727,6 @@ module Gitlab end def raw_log(options) - default_options = { - limit: 10, - offset: 0, - path: nil, - follow: false, - skip_merges: false, - disable_walk: false, - after: nil, - before: nil - } - - options = default_options.merge(options) - options[:limit] ||= 0 - options[:offset] ||= 0 actual_ref = options[:ref] || root_ref begin sha = sha_from_ref(actual_ref) |