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
3d701a7c
Commit
3d701a7c
authored
Jul 01, 2019
by
Patrick Bajao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't show image diff note on text file
parent
8775e4a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
changelogs/unreleased/58808-fix-image-diff-on-text.yml
changelogs/unreleased/58808-fix-image-diff-on-text.yml
+5
-0
lib/gitlab/diff/lines_unfolder.rb
lib/gitlab/diff/lines_unfolder.rb
+1
-1
spec/lib/gitlab/diff/lines_unfolder_spec.rb
spec/lib/gitlab/diff/lines_unfolder_spec.rb
+33
-0
No files found.
changelogs/unreleased/58808-fix-image-diff-on-text.yml
0 → 100644
View file @
3d701a7c
---
title
:
Don't show image diff note on text file
merge_request
:
30221
author
:
type
:
fixed
lib/gitlab/diff/lines_unfolder.rb
View file @
3d701a7c
...
...
@@ -54,7 +54,7 @@ module Gitlab
def
unfold_required?
strong_memoize
(
:unfold_required
)
do
next
false
unless
@diff_file
.
text?
next
false
unless
@position
.
unchanged?
next
false
unless
@position
.
on_text?
&&
@position
.
unchanged?
next
false
if
@diff_file
.
new_file?
||
@diff_file
.
deleted_file?
next
false
unless
@position
.
old_line
# Invalid position (MR import scenario)
...
...
spec/lib/gitlab/diff/lines_unfolder_spec.rb
View file @
3d701a7c
...
...
@@ -842,4 +842,37 @@ describe Gitlab::Diff::LinesUnfolder do
end
end
end
context
'positioned on an image'
do
let
(
:position
)
do
Gitlab
::
Diff
::
Position
.
new
(
base_sha:
'1c59dfa64afbea8c721bb09a06a9d326c952ea19'
,
start_sha:
'1c59dfa64afbea8c721bb09a06a9d326c952ea19'
,
head_sha:
'1487062132228de836236c522fe52fed4980a46c'
,
old_path:
'image.jpg'
,
new_path:
'image.jpg'
,
position_type:
'image'
)
end
before
do
allow
(
old_blob
).
to
receive
(
:binary?
).
and_return
(
binary?
)
end
context
'diff file is not text'
do
let
(
:binary?
)
{
true
}
it
'returns nil'
do
expect
(
subject
.
unfolded_diff_lines
).
to
be_nil
end
end
context
'diff file is text'
do
let
(
:binary?
)
{
false
}
it
'returns nil'
do
expect
(
subject
.
unfolded_diff_lines
).
to
be_nil
end
end
end
end
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