diff options
author | Robert Speicher <robert@gitlab.com> | 2017-05-14 20:03:15 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-05-14 20:03:15 +0000 |
commit | 133d2bb40a6c8516a8c8c487f347fa99bd7e907c (patch) | |
tree | a7ca8b65fc5ddf1a802dd8735d22fd0851886048 /app | |
parent | f70075b6d09e8cdf0898afb3d8696b881228c363 (diff) | |
parent | 99feed6e00e0f012f7e879a710e8b478b6160d2f (diff) | |
download | gitlab-ce-133d2bb40a6c8516a8c8c487f347fa99bd7e907c.tar.gz |
Merge branch 'fix/support-commit-deltas-only-for-gitaly' into 'master'
Fetch commit deltas from Gitaly
Closes gitaly#199
See merge request !11122
Diffstat (limited to 'app')
-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) |