diff options
author | Lin Jen-Shin (godfat) <godfat@godfat.org> | 2017-10-27 18:55:08 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-10-27 18:55:08 +0300 |
commit | 57d7ed05d96928f7e33135e7397bdd6b3b0d25e0 (patch) | |
tree | cc5f65076fc0acc1b5ff191d502a706e797544af /lib/gitlab/git/repository.rb | |
parent | 7c4da276d34e008b5aa86971cfd627a813d84df7 (diff) |
Fetch the merged branches at once
Diffstat (limited to 'lib/gitlab/git/repository.rb')
-rw-r--r-- | lib/gitlab/git/repository.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 408616d174b..fc8af38d4d9 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -511,6 +511,10 @@ module Gitlab gitaly_commit_client.ancestor?(from, to) end + def merged_branch_names(branch_names = []) + Set.new(git_merged_branch_names(branch_names)) + end + # Return an array of Diff objects that represent the diff # between +from+ and +to+. See Diff::filter_diff_options for the allowed # diff options. The +options+ hash can also include :break_rewrites to @@ -1190,6 +1194,13 @@ module Gitlab sort_branches(branches, sort_by) end + def git_merged_branch_names(branch_names = []) + lines = run_git(['branch', '--merged', root_ref] + branch_names) + .first.lines + + lines.map(&:strip) + end + def log_using_shell?(options) options[:path].present? || options[:disable_walk] || |