Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2017-05-05 17:55:12 +0300
committerAhmad Sherif <me@ahmadsherif.com>2017-05-13 19:27:06 +0300
commit99feed6e00e0f012f7e879a710e8b478b6160d2f (patch)
tree0246a5b1a494fcf4e59c17b0183cc2e614194b22 /app/models/commit.rb
parentaa6f44328ed22ebab51440a5a04f6b62d6471b78 (diff)
Add support for deltas_only under Gitaly
Closes gitaly#199
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb12
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)