Commit b012abee authored by Jacob Vosmaer's avatar Jacob Vosmaer

Make all Gitaly diff flags mandatory

parent f5b12225
...@@ -42,12 +42,10 @@ module Gitlab ...@@ -42,12 +42,10 @@ module Gitlab
return if @overflow return if @overflow
return if @iterator.nil? return if @iterator.nil?
Gitlab::GitalyClient.migrate(:commit_raw_diffs) do |is_enabled| if @iterator.is_a?(Gitlab::GitalyClient::DiffStitcher)
if is_enabled && @iterator.is_a?(Gitlab::GitalyClient::DiffStitcher) each_gitaly_patch(&block)
each_gitaly_patch(&block) else
else each_serialized_patch(&block)
each_rugged_patch(&block)
end
end end
@populated = true @populated = true
...@@ -118,7 +116,7 @@ module Gitlab ...@@ -118,7 +116,7 @@ module Gitlab
end end
end end
def each_rugged_patch def each_serialized_patch
i = @array.length i = @array.length
@iterator.each do |raw| @iterator.each do |raw|
......
...@@ -555,13 +555,7 @@ module Gitlab ...@@ -555,13 +555,7 @@ module Gitlab
# diff options. The +options+ hash can also include :break_rewrites to # diff options. The +options+ hash can also include :break_rewrites to
# split larger rewrites into delete/add pairs. # split larger rewrites into delete/add pairs.
def diff(from, to, options = {}, *paths) def diff(from, to, options = {}, *paths)
iterator = gitaly_migrate(:diff_between) do |is_enabled| iterator = gitaly_commit_client.diff(from, to, options.merge(paths: paths))
if is_enabled
gitaly_commit_client.diff(from, to, options.merge(paths: paths))
else
diff_patches(from, to, options, *paths)
end
end
Gitlab::Git::DiffCollection.new(iterator, options) Gitlab::Git::DiffCollection.new(iterator, options)
end end
......
...@@ -91,16 +91,12 @@ module Gitlab ...@@ -91,16 +91,12 @@ module Gitlab
end end
def send_git_diff(repository, diff_refs) def send_git_diff(repository, diff_refs)
params = if Gitlab::GitalyClient.feature_enabled?(:workhorse_send_git_diff, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) params = {
{ 'GitalyServer' => gitaly_server_hash(repository),
'GitalyServer' => gitaly_server_hash(repository), 'RawDiffRequest' => Gitaly::RawDiffRequest.new(
'RawDiffRequest' => Gitaly::RawDiffRequest.new( gitaly_diff_or_patch_hash(repository, diff_refs)
gitaly_diff_or_patch_hash(repository, diff_refs) ).to_json
).to_json }
}
else
workhorse_diff_or_patch_hash(repository, diff_refs)
end
[ [
SEND_DATA_HEADER, SEND_DATA_HEADER,
......
...@@ -143,34 +143,22 @@ describe Gitlab::Workhorse do ...@@ -143,34 +143,22 @@ describe Gitlab::Workhorse do
let(:diff_refs) { double(base_sha: "base", head_sha: "head") } let(:diff_refs) { double(base_sha: "base", head_sha: "head") }
subject { described_class.send_git_diff(repository, diff_refs) } subject { described_class.send_git_diff(repository, diff_refs) }
context 'when Gitaly workhorse_send_git_diff feature is enabled' do it 'sets the header correctly' do
it 'sets the header correctly' do key, command, params = decode_workhorse_header(subject)
key, command, params = decode_workhorse_header(subject)
expect(key).to eq("Gitlab-Workhorse-Send-Data")
expect(command).to eq("git-diff")
expect(params).to eq({
'GitalyServer' => {
address: Gitlab::GitalyClient.address(project.repository_storage),
token: Gitlab::GitalyClient.token(project.repository_storage)
},
'RawDiffRequest' => Gitaly::RawDiffRequest.new(
repository: repository.gitaly_repository,
left_commit_id: 'base',
right_commit_id: 'head'
).to_json
}.deep_stringify_keys)
end
end
context 'when Gitaly workhorse_send_git_diff feature is disabled', :disable_gitaly do
it 'sets the header correctly' do
key, command, params = decode_workhorse_header(subject)
expect(key).to eq("Gitlab-Workhorse-Send-Data") expect(key).to eq("Gitlab-Workhorse-Send-Data")
expect(command).to eq("git-diff") expect(command).to eq("git-diff")
expect(params).to eq("RepoPath" => repository.path_to_repo, "ShaFrom" => "base", "ShaTo" => "head") expect(params).to eq({
end 'GitalyServer' => {
address: Gitlab::GitalyClient.address(project.repository_storage),
token: Gitlab::GitalyClient.token(project.repository_storage)
},
'RawDiffRequest' => Gitaly::RawDiffRequest.new(
repository: repository.gitaly_repository,
left_commit_id: 'base',
right_commit_id: 'head'
).to_json
}.deep_stringify_keys)
end end
end end
......
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