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
988c1753
Commit
988c1753
authored
Dec 02, 2019
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIx diff file creation
- In case when DiffFile is not found - In case when DiffLine is not found
parent
1578bae2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
app/models/diff_note.rb
app/models/diff_note.rb
+12
-14
No files found.
app/models/diff_note.rb
View file @
988c1753
...
...
@@ -37,7 +37,8 @@ class DiffNote < Note
creation_params
=
diff_file
.
diff
.
to_hash
.
except
(
:too_large
)
.
merge
(
diff:
diff_file
.
diff_hunk
(
diff_line
))
creation_params
.
merge
(
diff:
diff_file
.
diff_hunk
(
diff_line
))
if
diff_line
create_note_diff_file
(
creation_params
)
end
...
...
@@ -109,19 +110,16 @@ class DiffNote < Note
def
fetch_diff_file
return
note_diff_file
.
raw_diff_file
if
note_diff_file
file
=
if
created_at_diff?
(
noteable
.
diff_refs
)
# We're able to use the already persisted diffs (Postgres) if we're
# presenting a "current version" of the MR discussion diff.
# So no need to make an extra Gitaly diff request for it.
# As an extra benefit, the returned `diff_file` already
# has `highlighted_diff_lines` data set from Redis on
# `Diff::FileCollection::MergeRequestDiff`.
noteable
.
diffs
(
original_position
.
diff_options
).
diff_files
.
first
else
original_position
.
diff_file
(
repository
)
end
if
created_at_diff?
(
noteable
.
diff_refs
)
# We're able to use the already persisted diffs (Postgres) if we're
# presenting a "current version" of the MR discussion diff.
# So no need to make an extra Gitaly diff request for it.
# As an extra benefit, the returned `diff_file` already
# has `highlighted_diff_lines` data set from Redis on
# `Diff::FileCollection::MergeRequestDiff`.
file
=
noteable
.
diffs
(
original_position
.
diff_options
).
diff_files
.
first
end
file
||=
original_position
.
diff_file
(
repository
)
file
&
.
unfold_diff_lines
(
position
)
...
...
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