Merge branch 'gh-pull-requests' into 'master'
Fix importer for GitHub Pull Requests when a branch was reused across Pull Requests Closes #17766 ## What does this MR do? GitHub importer fails when a repository has two Pull Requests, with the same branch name and different SHA, one of which was closed without merging, and one which is open or was merged in. This happens because we only checks if the branch exists in the [Gitlab::GithubImport::BranchFormatter#exists?](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/github_import/branch_formatter.rb#L6-8), before creating the missing references on Github. With this MR we check if both branch, and SHA exists in the current project. If no, we create the missing reference on GitHub before import the PR. ## Are there points in the code the reviewer needs to double check? Nope. ## Why was this MR needed? Github importer will fail if branch was reused across Pull Requests. ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/gitlab-ce/issues/19439 /cc @royaldark @thomasjachmann See merge request !5103
Showing with 35 additions and 19 deletions