From c0a4f527db7d3e10f843468522d574cdb5427e86 Mon Sep 17 00:00:00 2001 From: Ahmad Sherif Date: Fri, 24 Feb 2017 17:53:44 +0200 Subject: Use Gitaly for CommitController#show --- app/models/commit.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index 0a18986ef26..d5ecbe76c82 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -317,7 +317,14 @@ class Commit end def raw_diffs(*args) - raw.diffs(*args) + use_gitaly = Gitlab::GitalyClient.feature_enabled?(:commit_raw_diffs) + deltas_only = args.last.is_a?(Hash) && args.last[:deltas_only] + + if use_gitaly && !deltas_only + Gitlab::GitalyClient::Commit.diff_from_parent(self, *args) + else + raw.diffs(*args) + end end def diffs(diff_options = nil) -- cgit v1.2.1