summaryrefslogtreecommitdiff
path: root/lib/gitlab/gitaly_client
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-06-22 16:50:30 +0000
committerRobert Speicher <robert@gitlab.com>2017-06-22 16:50:30 +0000
commit826d5b7b511c422913e3e77ad5374f7bc5cc767d (patch)
tree433dad77e620031e5a98f9a8c5dd179c1eb29e46 /lib/gitlab/gitaly_client
parent8fe5602c1a4c3ca1815d31e6845dd3d3c2895ec9 (diff)
parent5b092d21cca71dde8f032dfcb9b7b41612a8727f (diff)
downloadgitlab-ce-826d5b7b511c422913e3e77ad5374f7bc5cc767d.tar.gz
Merge branch 'fix/properly-encode-gitaly-diffs' into 'master'
Encode Gitaly diff patches properly See merge request !12368
Diffstat (limited to 'lib/gitlab/gitaly_client')
-rw-r--r--lib/gitlab/gitaly_client/diff_stitcher.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/gitlab/gitaly_client/diff_stitcher.rb b/lib/gitlab/gitaly_client/diff_stitcher.rb
index d84e8d752dc..65d81dc5d46 100644
--- a/lib/gitlab/gitaly_client/diff_stitcher.rb
+++ b/lib/gitlab/gitaly_client/diff_stitcher.rb
@@ -13,7 +13,10 @@ module Gitlab
@rpc_response.each do |diff_msg|
if current_diff.nil?
diff_params = diff_msg.to_h.slice(*GitalyClient::Diff::FIELDS)
- diff_params[:patch] = diff_msg.raw_patch_data
+ # gRPC uses frozen strings by default, and we need to have an unfrozen string as it
+ # gets processed further down the line. So we unfreeze the first chunk of the patch
+ # in case it's the only chunk we receive for this diff.
+ diff_params[:patch] = diff_msg.raw_patch_data.dup
current_diff = GitalyClient::Diff.new(diff_params)
else