Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 0da71d87457..9039bdf1a20 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -1168,6 +1168,16 @@ class Repository
@cache ||= Gitlab::RepositoryCache.new(self)
end
+ def remove_prohibited_branches
+ return unless exists?
+
+ prohibited_branches = raw_repository.branch_names.select { |name| name.match(/\A\h{40}\z/) }
+
+ return if prohibited_branches.blank?
+
+ prohibited_branches.each { |name| raw_repository.delete_branch(name) }
+ end
+
private
# TODO Genericize finder, later split this on finders by Ref or Oid