diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-07-14 14:59:29 +0200 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-07-14 15:08:33 +0200 |
commit | 000ec953992c69679acfcd4f783ac0e2c9b71953 (patch) | |
tree | 51d2633349435508e59e44161e0d3715ef47d8a0 | |
parent | 7fbcdfb074a0ca92e3d35f6b3c4d78f1940f88ef (diff) | |
download | gitlab-ce-000ec953992c69679acfcd4f783ac0e2c9b71953.tar.gz |
Make branch filter support private
-rw-r--r-- | lib/gitlab/git/repository.rb | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 639f5625d59..8e7950a47d3 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -80,16 +80,8 @@ module Gitlab end # Returns an Array of Branches - def branches(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) + def branches(sort_by: nil) + branches_filter(sort_by: sort_by) end def reload_rugged @@ -115,7 +107,7 @@ module Gitlab if is_enabled gitaly_ref_client.local_branches(sort_by: sort_by) else - branches(filter: :local, sort_by: sort_by) + branches_filter(filter: :local, sort_by: sort_by) end end end @@ -837,6 +829,19 @@ module Gitlab 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) default_options = { limit: 10, |