diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2017-02-24 17:53:44 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2017-03-15 12:52:11 +0200 |
commit | c0a4f527db7d3e10f843468522d574cdb5427e86 (patch) | |
tree | 2df0d759bee66951ea1a2b3cd8fa3c0880d26790 /app/models/commit.rb | |
parent | b716680692b4d5f7565e29e8fbd1737d24cbf658 (diff) | |
download | gitlab-ce-feature/use-gitaly-for-commit-show.tar.gz |
Use Gitaly for CommitController#showfeature/use-gitaly-for-commit-show
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 9 |
1 files changed, 8 insertions, 1 deletions
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) |