gitlab-org--gitlab-foss/spec
Rémy Coutable 8e5bf15732 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
2016-07-06 17:25:40 +00:00
..
config
controllers Assert against `ActionMailer::Base.deliveries` relatively. 2016-07-05 10:20:32 +05:30
factories
features Fix specs 2016-07-06 17:52:59 +02:00
finders Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
fixtures
helpers Move `unescape_html_entities` from LabelsHelper to Label model 2016-07-05 20:57:09 -03:00
initializers Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
javascripts
lib Consider that a GH exists only if both `ref`, and `sha` exist 2016-07-06 13:08:12 -03:00
mailers Merge branch 'explicit-requesters-scope' into 'master' 2016-07-01 22:23:26 +00:00
models Merge branch '19092-fix-event-for-legacydiffnote-not-considered-note' into 'master' 2016-07-06 15:25:54 +00:00
requests Allow '?', or '&' for label titles 2016-07-05 20:57:09 -03:00
routing Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
services Handle custom Git hook result in GitLab UI 2016-07-04 20:16:55 +03:00
support Merge branch 'user-avatar-header' into 'master' 2016-07-04 18:51:12 +00:00
tasks/gitlab Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
views
workers Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
factories_spec.rb
rails_helper.rb
spec_helper.rb
teaspoon_env.rb