summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2017-08-07 18:05:06 +0200
committerJacob Vosmaer <jacob@gitlab.com>2017-08-07 18:05:06 +0200
commitf278e5fb3e272673ca730b773821bc432f81597e (patch)
treeb711e5e0b03c76542d9354015c577db6eba30680 /lib
parentff1fa39cd847f8311168684c4daa67472c509882 (diff)
downloadgitlab-ce-f278e5fb3e272673ca730b773821bc432f81597e.tar.gz
Set default options outside the raw_log method
The raw_log method is meant to become the Gitaly RPC boundary. By setting the defaults before doing the RPC we keep the RPC implementation simpler. We also sidestep the unfortunate subtleties of what happens when options[:limit] is not set, or nil.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git/repository.rb29
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)