Commit 829b1d64 authored by John Cai's avatar John Cai

Use original repository for list conflict call

parent 2ec6f251
...@@ -5,8 +5,11 @@ module Gitlab ...@@ -5,8 +5,11 @@ module Gitlab
class ConflictFilesStitcher class ConflictFilesStitcher
include Enumerable include Enumerable
def initialize(rpc_response) attr_reader :gitaly_repo
def initialize(rpc_response, gitaly_repo)
@rpc_response = rpc_response @rpc_response = rpc_response
@gitaly_repo = gitaly_repo
end end
def each def each
...@@ -31,7 +34,7 @@ module Gitlab ...@@ -31,7 +34,7 @@ module Gitlab
def file_from_gitaly_header(header) def file_from_gitaly_header(header)
Gitlab::Git::Conflict::File.new( Gitlab::Git::Conflict::File.new(
Gitlab::GitalyClient::Util.git_repository(header.repository), Gitlab::GitalyClient::Util.git_repository(gitaly_repo),
header.commit_oid, header.commit_oid,
conflict_from_gitaly_file_header(header), conflict_from_gitaly_file_header(header),
'' ''
......
...@@ -22,7 +22,7 @@ module Gitlab ...@@ -22,7 +22,7 @@ module Gitlab
) )
response = GitalyClient.call(@repository.storage, :conflicts_service, :list_conflict_files, request, timeout: GitalyClient.long_timeout) response = GitalyClient.call(@repository.storage, :conflicts_service, :list_conflict_files, request, timeout: GitalyClient.long_timeout)
GitalyClient::ConflictFilesStitcher.new(response) GitalyClient::ConflictFilesStitcher.new(response, @gitaly_repo)
end end
def conflicts? def conflicts?
......
...@@ -32,7 +32,7 @@ describe Gitlab::GitalyClient::ConflictFilesStitcher do ...@@ -32,7 +32,7 @@ describe Gitlab::GitalyClient::ConflictFilesStitcher do
double(files: [double(header: nil, content: content_2[11..-1])]) double(files: [double(header: nil, content: content_2[11..-1])])
] ]
conflict_files = described_class.new(messages).to_a conflict_files = described_class.new(messages, target_repository.gitaly_repository).to_a
expect(conflict_files.size).to be(2) expect(conflict_files.size).to be(2)
......
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