diff options
author | Rémy Coutable <remy@rymai.me> | 2017-11-15 15:18:07 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-11-15 15:18:07 +0100 |
commit | 54533920bc81319159297c7f7c1c8c2451baf151 (patch) | |
tree | 4cafb0ef86b01fbcfe8a3693566f5fc815777c90 | |
parent | a4072db0198896242886d22c644ed91c1016aa8d (diff) | |
download | gitlab-ce-54533920bc81319159297c7f7c1c8c2451baf151.tar.gz |
Always fetch master from the canonical remote
This way, if a fork's master branch is far behind the canonical's
master, it won't use the tip of the fork's master branch as merge base
and thus won't create a huge and wrong patch file.
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r-- | lib/gitlab/ee_compat_check.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/ee_compat_check.rb b/lib/gitlab/ee_compat_check.rb index 0ea534a5fd0..efc2e46d289 100644 --- a/lib/gitlab/ee_compat_check.rb +++ b/lib/gitlab/ee_compat_check.rb @@ -193,7 +193,7 @@ module Gitlab # Repository is initially cloned with a depth of 20 so we need to fetch # deeper in the case the branch has more than 20 commits on top of master fetch(branch: branch, depth: depth) - fetch(branch: 'master', depth: depth) + fetch(branch: 'master', depth: depth, remote: DEFAULT_CE_PROJECT_URL) merge_base_found? end @@ -201,10 +201,10 @@ module Gitlab raise "\n#{branch} is too far behind master, please rebase it!\n" unless success end - def fetch(branch:, depth:) + def fetch(branch:, depth:, remote: 'origin') step( "Fetching deeper...", - %W[git fetch --depth=#{depth} --prune origin +refs/heads/#{branch}:refs/remotes/origin/#{branch}] + %W[git fetch --depth=#{depth} --prune #{remote} +refs/heads/#{branch}:refs/remotes/origin/#{branch}] ) do |output, status| raise "Fetch failed: #{output}" unless status.zero? end |