diff options
author | Robert Speicher <robert@gitlab.com> | 2017-05-07 22:59:30 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-05-07 22:59:30 +0000 |
commit | 8b9cd3c072768ca810d2b33009e35d93a05e417f (patch) | |
tree | 702515a306348f8146c3eb29419f6e591e954e10 /app/models | |
parent | f7cf2a7be6908ff577432a8c6b520a71361d4860 (diff) | |
parent | 2f60a402d1fa98bb0090343f8180fc03b715467e (diff) | |
download | gitlab-ce-8b9cd3c072768ca810d2b33009e35d93a05e417f.tar.gz |
Merge branch 'fix/support-gitaly-commit-diff-flags' into 'master'
Add support for commit diff ignore_whitespace_change and paths flags
Closes gitaly#198
See merge request !11028
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/commit.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 88a015cdb77..9359b323ed4 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -326,13 +326,14 @@ class Commit end def raw_diffs(*args) - # NOTE: This feature is intentionally disabled until - # https://gitlab.com/gitlab-org/gitaly/issues/178 is resolved - # if Gitlab::GitalyClient.feature_enabled?(:commit_raw_diffs) - # Gitlab::GitalyClient::Commit.diff_from_parent(self, *args) - # else - raw.diffs(*args) - # end + 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) |