Commit 0ca38056 authored by Jacob Vosmaer's avatar Jacob Vosmaer Committed by Alejandro Rodríguez

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.
parent c0e13e7b
......@@ -297,6 +297,21 @@ module Gitlab
# )
#
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
......@@ -710,20 +725,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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment