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
a5832ed0
Commit
a5832ed0
authored
Mar 21, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
8426a2d2
7d3c5d88
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
11 deletions
+28
-11
app/serializers/diff_file_entity.rb
app/serializers/diff_file_entity.rb
+1
-1
changelogs/unreleased/59147-duplicate-match-line.yml
changelogs/unreleased/59147-duplicate-match-line.yml
+5
-0
lib/gitlab/diff/file.rb
lib/gitlab/diff/file.rb
+15
-10
spec/lib/gitlab/diff/file_spec.rb
spec/lib/gitlab/diff/file_spec.rb
+7
-0
No files found.
app/serializers/diff_file_entity.rb
View file @
a5832ed0
...
@@ -57,7 +57,7 @@ class DiffFileEntity < DiffFileBaseEntity
...
@@ -57,7 +57,7 @@ class DiffFileEntity < DiffFileBaseEntity
diff_file
.
diff_lines_for_serializer
diff_file
.
diff_lines_for_serializer
end
end
expose
:is_fully_expanded
,
if:
->
(
diff_file
,
_
)
{
Feature
.
enabled?
(
:expand_diff_full_file
)
&&
diff_file
.
text?
}
do
|
diff_file
|
expose
:is_fully_expanded
,
if:
->
(
diff_file
,
_
)
{
Feature
.
enabled?
(
:expand_diff_full_file
,
default_enabled:
true
)
&&
diff_file
.
text?
}
do
|
diff_file
|
diff_file
.
fully_expanded?
diff_file
.
fully_expanded?
end
end
...
...
changelogs/unreleased/59147-duplicate-match-line.yml
0 → 100644
View file @
a5832ed0
---
title
:
Fix duplicated bottom match line on merge request parallel diff view
merge_request
:
26402
author
:
type
:
fixed
lib/gitlab/diff/file.rb
View file @
a5832ed0
...
@@ -158,7 +158,10 @@ module Gitlab
...
@@ -158,7 +158,10 @@ module Gitlab
new_blob
||
old_blob
new_blob
||
old_blob
end
end
attr_writer
:highlighted_diff_lines
def
highlighted_diff_lines
=
(
value
)
clear_memoization
(
:diff_lines_for_serializer
)
@highlighted_diff_lines
=
value
end
# Array of Gitlab::Diff::Line objects
# Array of Gitlab::Diff::Line objects
def
diff_lines
def
diff_lines
...
@@ -314,10 +317,11 @@ module Gitlab
...
@@ -314,10 +317,11 @@ module Gitlab
# This adds the bottom match line to the array if needed. It contains
# This adds the bottom match line to the array if needed. It contains
# the data to load more context lines.
# the data to load more context lines.
def
diff_lines_for_serializer
def
diff_lines_for_serializer
strong_memoize
(
:diff_lines_for_serializer
)
do
lines
=
highlighted_diff_lines
lines
=
highlighted_diff_lines
return
if
lines
.
empty?
next
if
lines
.
empty?
return
if
blob
.
nil?
next
if
blob
.
nil?
last_line
=
lines
.
last
last_line
=
lines
.
last
...
@@ -328,6 +332,7 @@ module Gitlab
...
@@ -328,6 +332,7 @@ module Gitlab
lines
lines
end
end
end
def
fully_expanded?
def
fully_expanded?
return
true
if
binary?
return
true
if
binary?
...
...
spec/lib/gitlab/diff/file_spec.rb
View file @
a5832ed0
...
@@ -72,6 +72,13 @@ describe Gitlab::Diff::File do
...
@@ -72,6 +72,13 @@ describe Gitlab::Diff::File do
expect
(
diff_file
.
diff_lines_for_serializer
.
last
.
type
).
to
eq
(
'match'
)
expect
(
diff_file
.
diff_lines_for_serializer
.
last
.
type
).
to
eq
(
'match'
)
end
end
context
'when called multiple times'
do
it
'only adds bottom match line once'
do
expect
(
diff_file
.
diff_lines_for_serializer
.
size
).
to
eq
(
31
)
expect
(
diff_file
.
diff_lines_for_serializer
.
size
).
to
eq
(
31
)
end
end
context
'when deleted'
do
context
'when deleted'
do
let
(
:commit
)
{
project
.
commit
(
'd59c60028b053793cecfb4022de34602e1a9218e'
)
}
let
(
:commit
)
{
project
.
commit
(
'd59c60028b053793cecfb4022de34602e1a9218e'
)
}
let
(
:diff_file
)
{
commit
.
diffs
.
diff_file_with_old_path
(
'files/js/commit.js.coffee'
)
}
let
(
:diff_file
)
{
commit
.
diffs
.
diff_file_with_old_path
(
'files/js/commit.js.coffee'
)
}
...
...
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