Commit 7e2188a1 authored by Paul Okstad's avatar Paul Okstad Committed by Douglas Barbosa Alexandre

Change GetRawChanges RPC to use bytes

parent d6588577
---
title: Expect bytes from Gitaly RPC GetRawChanges
merge_request: 28164
author:
type: fixed
......@@ -11,8 +11,8 @@ module Gitlab
if raw_change.is_a?(Gitaly::GetRawChangesResponse::RawChange)
@blob_id = raw_change.blob_id
@blob_size = raw_change.size
@old_path = raw_change.old_path.presence
@new_path = raw_change.new_path.presence
@old_path = raw_change.old_path_bytes.presence
@new_path = raw_change.new_path_bytes.presence
@operation = raw_change.operation&.downcase || :unknown
else
parse(raw_change)
......
......@@ -844,6 +844,19 @@ describe Repository do
end
end
describe '#get_raw_changes' do
context `with non-UTF8 bytes in paths` do
let(:old_rev) { 'd0888d297eadcd7a345427915c309413b1231e65' }
let(:new_rev) { '19950f03c765f7ac8723a73a0599764095f52fc0' }
let(:changes) { repository.raw_changes_between(old_rev, new_rev) }
it 'returns the changes' do
expect { changes }.not_to raise_error
expect(changes.first.new_path.bytes).to eq("hello\x80world".bytes)
end
end
end
describe '#create_ref' do
it 'redirects the call to write_ref' do
ref, ref_path = '1', '2'
......
......@@ -64,7 +64,8 @@ module TestEnv
'with-codeowners' => '219560e',
'submodule_inside_folder' => 'b491b92',
'png-lfs' => 'fe42f41',
'sha-starting-with-large-number' => '8426165'
'sha-starting-with-large-number' => '8426165',
'invalid-utf8-diff-paths' => '99e4853'
}.freeze
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
......
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