summaryrefslogtreecommitdiff
path: root/lib/gitlab/github_import/importer/protected_branches_importer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/github_import/importer/protected_branches_importer.rb')
-rw-r--r--lib/gitlab/github_import/importer/protected_branches_importer.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab/github_import/importer/protected_branches_importer.rb b/lib/gitlab/github_import/importer/protected_branches_importer.rb
index 4372477f55d..ff425528aec 100644
--- a/lib/gitlab/github_import/importer/protected_branches_importer.rb
+++ b/lib/gitlab/github_import/importer/protected_branches_importer.rb
@@ -13,13 +13,15 @@ module Gitlab
protected_branches = client.branches(repo).select { |branch| branch.dig(:protection, :enabled) }
protected_branches.each do |protected_branch|
+ next if already_imported?(protected_branch)
+
object = client.branch_protection(repo, protected_branch[:name])
- next if object.nil? || already_imported?(object)
+ next if object.nil?
yield object
Gitlab::GithubImport::ObjectCounter.increment(project, object_type, :fetched)
- mark_as_imported(object)
+ mark_as_imported(protected_branch)
end
end