diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-06-13 08:26:00 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-06-13 08:26:00 +0000 |
commit | 4666ef683c75b5c053e579010926e03cdffa497f (patch) | |
tree | 961a0c8526d4a16af7854c0175b90c8c28e6b037 | |
parent | decfe70bb10d48349822a998ebe3666d2cb460f2 (diff) | |
parent | d65db552af743a139e53abb99fe1ec51b6a440e0 (diff) | |
download | gitlab-ce-4666ef683c75b5c053e579010926e03cdffa497f.tar.gz |
Merge branch 'zj-compare-source-branch' into 'master'
Migrate compare_source_branch to use only Gitaly
Closes gitaly#771
See merge request gitlab-org/gitlab-ce!19700
-rw-r--r-- | lib/gitlab/git/repository.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index e883964a090..61ae42a116b 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1181,18 +1181,18 @@ module Gitlab end def compare_source_branch(target_branch_name, source_repository, source_branch_name, straight:) - Gitlab::GitalyClient::StorageSettings.allow_disk_access do - with_repo_branch_commit(source_repository, source_branch_name) do |commit| - break unless commit + tmp_ref = "refs/tmp/#{SecureRandom.hex}" - Gitlab::Git::Compare.new( - self, - target_branch_name, - commit.sha, - straight: straight - ) - end - end + return unless fetch_source_branch!(source_repository, source_branch_name, tmp_ref) + + Gitlab::Git::Compare.new( + self, + target_branch_name, + tmp_ref, + straight: straight + ) + ensure + delete_refs(tmp_ref) end def write_ref(ref_path, ref, old_ref: nil, shell: true) |