summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-08-25 22:38:07 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-08-25 22:38:07 +0800
commitd1054bd3ddb48c15b6a3a53f8c57974208094106 (patch)
tree73eb6d2cf9ab421929082feed05fef751e006473 /lib
parent932d32515a72bc80e021474100f677d954f3822e (diff)
downloadgitlab-ce-d1054bd3ddb48c15b6a3a53f8c57974208094106.tar.gz
Resolve feedback on the MR:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13766 * Rename AfterImportService * Use constants * Move Git operations to Gitlab::Git::Repository * Use Regexp.union
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git/repository.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index eb3731ba35a..f6d30ad7534 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -232,6 +232,13 @@ module Gitlab
branch_names + tag_names
end
+ # Returns an Array of all ref names, except when it's matching pattern
+ #
+ # regexp - The pattern for ref names we don't want
+ def all_ref_names_except(regexp)
+ rugged.references.reject { |ref| ref.name =~ regexp }.map(&:name)
+ end
+
# Discovers the default branch based on the repository's available branches
#
# - If no branches are present, returns nil
@@ -577,6 +584,10 @@ module Gitlab
rugged.branches.delete(branch_name)
end
+ def delete_refs(ref_names)
+ ref_names.each(&rugged.references.method(:delete))
+ end
+
# Create a new branch named **ref+ based on **stat_point+, HEAD by default
#
# Examples: