Commit 000ec953 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Make branch filter support private

parent 7fbcdfb0
...@@ -80,16 +80,8 @@ module Gitlab ...@@ -80,16 +80,8 @@ module Gitlab
end end
# Returns an Array of Branches # Returns an Array of Branches
def branches(filter: nil, sort_by: nil) def branches(sort_by: nil)
branches = rugged.branches.each(filter).map do |rugged_ref| branches_filter(sort_by: sort_by)
begin
Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target)
rescue Rugged::ReferenceError
# Omit invalid branch
end
end.compact
sort_branches(branches, sort_by)
end end
def reload_rugged def reload_rugged
...@@ -115,7 +107,7 @@ module Gitlab ...@@ -115,7 +107,7 @@ module Gitlab
if is_enabled if is_enabled
gitaly_ref_client.local_branches(sort_by: sort_by) gitaly_ref_client.local_branches(sort_by: sort_by)
else else
branches(filter: :local, sort_by: sort_by) branches_filter(filter: :local, sort_by: sort_by)
end end
end end
end end
...@@ -837,6 +829,19 @@ module Gitlab ...@@ -837,6 +829,19 @@ module Gitlab
private private
# Gitaly note: JV: Trying to get rid of the 'filter' option so we can implement this with 'git'.
def branches_filter(filter: nil, sort_by: nil)
branches = rugged.branches.each(filter).map do |rugged_ref|
begin
Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target)
rescue Rugged::ReferenceError
# Omit invalid branch
end
end.compact
sort_branches(branches, sort_by)
end
def raw_log(options) def raw_log(options)
default_options = { default_options = {
limit: 10, limit: 10,
......
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