diff options
author | James Lopez <james@jameslopez.es> | 2017-09-07 09:47:15 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-09-07 09:47:15 +0300 |
commit | 9b1a321270408e5b642bb3f866769d51d38b155f (patch) | |
tree | 6bc10a86b0e5f03515c5f6d4af3034b89c47df74 | |
parent | d04f2547e9fd5b37b6206bbf96eb06aefd556100 (diff) |
fix a few issues to do with pull request branchesfix/gh-import-branches-performance
-rw-r--r-- | lib/github/representation/pull_request.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/github/representation/pull_request.rb b/lib/github/representation/pull_request.rb index c6a337ddc50..ec030ade38a 100644 --- a/lib/github/representation/pull_request.rb +++ b/lib/github/representation/pull_request.rb @@ -10,9 +10,9 @@ module Github def source_branch_name @source_branch_name ||= - if !opened? && !source_branch_exists? - source_branch_ref - elsif cross_project? + if opened? && project.repository.branch_exists?(source_branch.ref) + source_branch.ref + elsif cross_project? && opened? source_branch_name_prefixed else source_branch_ref @@ -22,7 +22,7 @@ module Github def source_branch_exists? return @source_branch_exists if defined?(@source_branch_exists) - @source_branch_exists = repository.branch_exists?(source_branch_name) + @source_branch_exists = project.repository.branch_exists?(source_branch_name) end def target_project @@ -68,11 +68,11 @@ module Github end def source_branch_ref - "refs/merge-requests/#{pull_request.iid}/head" + "refs/merge-requests/#{iid}/head" end def source_branch_name_prefixed - "gh-#{target_branch_short_sha}/#{iid}/#{source_branch_user}/#{source_branch_ref}" + "gh-#{target_branch_short_sha}/#{iid}/#{source_branch_user}/#{source_branch.ref}" end def target_branch |