diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-08-09 17:47:11 -0400 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-08-22 16:31:59 -0300 |
commit | 258d5a50e63d5e29b6a3adc0a250727a8232695b (patch) | |
tree | ed9d91250eebd52988e856d2d9e82aee9eead614 /lib | |
parent | 8936a92e811f51011eb405e379b0ca563b34936f (diff) | |
download | gitlab-ce-258d5a50e63d5e29b6a3adc0a250727a8232695b.tar.gz |
Incorporate DiffService.CommitPatch Gitaly RPCgitaly-commit-patch
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/commit.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/commit_service.rb | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index a499bbc6266..5ee6669050c 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -271,7 +271,13 @@ module Gitlab # # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/324 def to_diff - rugged_diff_from_parent.patch + Gitlab::GitalyClient.migrate(:commit_patch) do |is_enabled| + if is_enabled + @repository.gitaly_commit_client.patch(id) + else + rugged_diff_from_parent.patch + end + end end # Returns a diff object for the changes from this commit's first parent. diff --git a/lib/gitlab/gitaly_client/commit_service.rb b/lib/gitlab/gitaly_client/commit_service.rb index b36e81278d6..2a984b97e92 100644 --- a/lib/gitlab/gitaly_client/commit_service.rb +++ b/lib/gitlab/gitaly_client/commit_service.rb @@ -194,6 +194,16 @@ module Gitlab response.commit end + def patch(revision) + request = Gitaly::CommitPatchRequest.new( + repository: @gitaly_repo, + revision: GitalyClient.encode(revision) + ) + response = GitalyClient.call(@repository.storage, :diff_service, :commit_patch, request) + + response.sum(&:data) + end + private def commit_diff_request_params(commit, options = {}) |