diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2017-05-05 16:55:12 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2017-05-13 18:27:06 +0200 |
commit | 99feed6e00e0f012f7e879a710e8b478b6160d2f (patch) | |
tree | 0246a5b1a494fcf4e59c17b0183cc2e614194b22 /app/models/commit.rb | |
parent | aa6f44328ed22ebab51440a5a04f6b62d6471b78 (diff) | |
download | gitlab-ce-99feed6e00e0f012f7e879a710e8b478b6160d2f.tar.gz |
Add support for deltas_only under Gitaly
Closes gitaly#199
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 8d54ce6eb25..dbc0a22829e 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -327,13 +327,21 @@ class Commit def raw_diffs(*args) if Gitlab::GitalyClient.feature_enabled?(:commit_raw_diffs) - Gitlab::GitalyClient::Commit.diff_from_parent(self, *args) + Gitlab::GitalyClient::Commit.new(project.repository).diff_from_parent(self, *args) else raw.diffs(*args) end end - delegate :deltas, to: :raw, prefix: :raw + def raw_deltas + @deltas ||= Gitlab::GitalyClient.migrate(:commit_deltas) do |is_enabled| + if is_enabled + Gitlab::GitalyClient::Commit.new(project.repository).commit_deltas(self) + else + raw.deltas + end + end + end def diffs(diff_options = nil) Gitlab::Diff::FileCollection::Commit.new(self, diff_options: diff_options) |