diff options
author | Sean McGivern <sean@gitlab.com> | 2018-06-29 14:25:35 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-06-29 14:25:35 +0100 |
commit | 2c2422d54e4b12471dbc25dbc90cbbffe4fb1c2b (patch) | |
tree | 5ed5bbc3602f90ffe0481e5caa124e788bb63828 /lib | |
parent | 2dfddddd7b9995439209831e36ab133a66d13cef (diff) | |
download | gitlab-ce-2c2422d54e4b12471dbc25dbc90cbbffe4fb1c2b.tar.gz |
Fix MR diffs created with gitaly_diff_between enabled
When we save merge request diffs to the database, we need to expand the diff
before doing so. That's so that we can expand diffs (within the normal limits)
without hitting the repository, but just by going to the database.
This is done implicitly - diffs are expanded unless we say otherwise. However,
we have another option we can pass, that lets us enforce diff size limits, that
defaults to true.
Prior to this commit:
- The Rugged code path defaulted to setting `expanded: true` and
`enforce_limits: true`.
- The Gitaly code path defaulted to setting `expanded: false` and
`enforce_limits: true`.
This was introduced by eb36fa17a6ae5cda8950904b5a52e6aa365ae591, which
implemented the initial feature. Since then, if the `gitaly_diff_between`
feature flag was enabled, MRs would have diffs that could not be expanded in
some cases, with no fix other than to disable the feature flag and force push to
the MR to refresh the diff in the database.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/gitaly_client/commit_service.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/gitaly_client/commit_service.rb b/lib/gitlab/gitaly_client/commit_service.rb index c9c414e5d33..d979ba0eb14 100644 --- a/lib/gitlab/gitaly_client/commit_service.rb +++ b/lib/gitlab/gitaly_client/commit_service.rb @@ -368,7 +368,7 @@ module Gitlab def call_commit_diff(request_params, options = {}) request_params[:ignore_whitespace_change] = options.fetch(:ignore_whitespace_change, false) request_params[:enforce_limits] = options.fetch(:limits, true) - request_params[:collapse_diffs] = request_params[:enforce_limits] || !options.fetch(:expanded, true) + request_params[:collapse_diffs] = !options.fetch(:expanded, true) request_params.merge!(Gitlab::Git::DiffCollection.collection_limits(options).to_h) request = Gitaly::CommitDiffRequest.new(request_params) |