Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4148328b
Commit
4148328b
authored
Aug 03, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
21f2a39d
6316a420
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+2
-2
lib/gitlab/diff/file_collection/base.rb
lib/gitlab/diff/file_collection/base.rb
+6
-0
spec/models/merge_request_diff_spec.rb
spec/models/merge_request_diff_spec.rb
+5
-2
No files found.
app/models/merge_request_diff.rb
View file @
4148328b
...
...
@@ -395,10 +395,10 @@ class MergeRequestDiff < ApplicationRecord
if
comparison
if
diff_options
[
:paths
].
blank?
&&
!
without_files?
# Return the empty MergeRequestDiffBatch for an out of bound batch request
break
diffs_batch
if
diffs_batch
.
diff_
file_
paths
.
blank?
break
diffs_batch
if
diffs_batch
.
diff_paths
.
blank?
diff_options
.
merge!
(
paths:
diffs_batch
.
diff_
file_
paths
,
paths:
diffs_batch
.
diff_paths
,
pagination_data:
diffs_batch
.
pagination_data
)
end
...
...
lib/gitlab/diff/file_collection/base.rb
View file @
4148328b
...
...
@@ -43,10 +43,16 @@ module Gitlab
end
end
# This is either the new path, otherwise the old path for the diff_file
def
diff_file_paths
diff_files
.
map
(
&
:file_path
)
end
# This is both the new and old paths for the diff_file
def
diff_paths
diff_files
.
map
(
&
:paths
).
flatten
.
uniq
end
def
pagination_data
@pagination_data
||
empty_pagination_data
end
...
...
spec/models/merge_request_diff_spec.rb
View file @
4148328b
...
...
@@ -465,11 +465,13 @@ RSpec.describe MergeRequestDiff do
it
'sorts diff files directory first'
do
diff_with_commits
.
update!
(
sorted:
false
)
# Mark as unsorted so it'll re-order
expect
(
diff_with_commits
.
diffs_in_batch
(
0
,
10
,
diff_options:
diff_options
).
diff_file_paths
).
to
eq
([
# There will be 11 returned, as we have to take into account for new and old paths
expect
(
diff_with_commits
.
diffs_in_batch
(
0
,
10
,
diff_options:
diff_options
).
diff_paths
).
to
eq
([
'bar/branch-test.txt'
,
'custom-highlighting/test.gitlab-custom'
,
'encoding/iso8859.txt'
,
'files/images/wm.svg'
,
'files/js/commit.js.coffee'
,
'files/js/commit.coffee'
,
'files/lfs/lfs_object.iso'
,
'files/ruby/popen.rb'
,
...
...
@@ -553,11 +555,12 @@ RSpec.describe MergeRequestDiff do
it
'sorts diff files directory first'
do
diff_with_commits
.
update!
(
sorted:
false
)
# Mark as unsorted so it'll re-order
expect
(
diff_with_commits
.
diffs
(
diff_options
).
diff_
file_
paths
).
to
eq
([
expect
(
diff_with_commits
.
diffs
(
diff_options
).
diff_paths
).
to
eq
([
'bar/branch-test.txt'
,
'custom-highlighting/test.gitlab-custom'
,
'encoding/iso8859.txt'
,
'files/images/wm.svg'
,
'files/js/commit.js.coffee'
,
'files/js/commit.coffee'
,
'files/lfs/lfs_object.iso'
,
'files/ruby/popen.rb'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment