diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2017-03-07 10:36:42 +0100 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2017-03-10 21:08:21 +0100 |
commit | 9b53cb6c88f406c947df24debcba0f87c66cbfcf (patch) | |
tree | 8874710fb35b8830d500bd68e408d7b05faf34ad /lib | |
parent | c4ba6ea684052ff555e8683c23be5b25bf5abd11 (diff) | |
download | gitlab-ce-9b53cb6c88f406c947df24debcba0f87c66cbfcf.tar.gz |
Fix GitHub Import for open PRs from a fork
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/github_import/importer.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/github_import/pull_request_formatter.rb | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb index dc73cad93a5..055a07781a5 100644 --- a/lib/gitlab/github_import/importer.rb +++ b/lib/gitlab/github_import/importer.rb @@ -148,7 +148,7 @@ module Gitlab rescue => e errors << { type: :pull_request, url: Gitlab::UrlSanitizer.sanitize(gh_pull_request.url), errors: e.message } ensure - clean_up_restored_branches(gh_pull_request) + clean_up_restored_branches(gh_pull_request) unless gh_pull_request.opened? end end end diff --git a/lib/gitlab/github_import/pull_request_formatter.rb b/lib/gitlab/github_import/pull_request_formatter.rb index 28812fd0cb9..0a31e3888bd 100644 --- a/lib/gitlab/github_import/pull_request_formatter.rb +++ b/lib/gitlab/github_import/pull_request_formatter.rb @@ -60,6 +60,18 @@ module Gitlab source_branch.repo.id != target_branch.repo.id end + def opened? + state == 'opened' + end + + def closed? + state == 'closed' + end + + def merged? + state == 'merged' + end + private def state |