Commit 4666ef68 authored by Sean McGivern's avatar Sean McGivern

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
parents decfe70b d65db552
...@@ -1181,18 +1181,18 @@ module Gitlab ...@@ -1181,18 +1181,18 @@ module Gitlab
end end
def compare_source_branch(target_branch_name, source_repository, source_branch_name, straight:) def compare_source_branch(target_branch_name, source_repository, source_branch_name, straight:)
Gitlab::GitalyClient::StorageSettings.allow_disk_access do tmp_ref = "refs/tmp/#{SecureRandom.hex}"
with_repo_branch_commit(source_repository, source_branch_name) do |commit|
break unless commit
Gitlab::Git::Compare.new( return unless fetch_source_branch!(source_repository, source_branch_name, tmp_ref)
self,
target_branch_name, Gitlab::Git::Compare.new(
commit.sha, self,
straight: straight target_branch_name,
) tmp_ref,
end straight: straight
end )
ensure
delete_refs(tmp_ref)
end end
def write_ref(ref_path, ref, old_ref: nil, shell: true) def write_ref(ref_path, ref, old_ref: nil, shell: true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment