GitHub importer doesn't import all protected branches
Summary
When importing project with several protected branches from GitHub, only one of them is migrated.
Steps to reproduce
- Have a project with several branches on GitHub
- On GitHub create any branch protection rules for 2 non-default branches
- Import the project to GitLab
- Go to project -> Settings -> Repository -> Protected branches
- Look at the list of protected branches
Example Project
What is the current bug behavior?
Only one of the non-default protected on GitHub branches is displayed in the list.
What is the expected correct behavior?
All branches that were protected on GitHub are displayed in the list.
Relevant logs and/or screenshots
Source Project Protected Branch Rules (on GitHub):
Destination Project Protected Branch Rules (on GitLab):
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
The line of code that might be responsible for the problem - https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/github_import/importer/protected_branches_importer.rb#L22.