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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
63d38a30
Commit
63d38a30
authored
Apr 24, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix commenting on an existing discussion on an unchanged line that is no longer in the diff
parent
1005389f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
changelogs/unreleased/dm-fix-position-tracer-for-hidden-lines.yml
...gs/unreleased/dm-fix-position-tracer-for-hidden-lines.yml
+5
-0
lib/gitlab/diff/position_tracer.rb
lib/gitlab/diff/position_tracer.rb
+8
-1
spec/lib/gitlab/diff/position_tracer_spec.rb
spec/lib/gitlab/diff/position_tracer_spec.rb
+2
-7
No files found.
changelogs/unreleased/dm-fix-position-tracer-for-hidden-lines.yml
0 → 100644
View file @
63d38a30
---
title
:
Fix commenting on an existing discussion on an unchanged line that is no longer
in the diff
merge_request
:
author
:
lib/gitlab/diff/position_tracer.rb
View file @
63d38a30
...
@@ -82,7 +82,7 @@ module Gitlab
...
@@ -82,7 +82,7 @@ module Gitlab
file_diff
,
old_line
,
new_line
=
results
file_diff
,
old_line
,
new_line
=
results
Position
.
new
(
new_position
=
Position
.
new
(
old_path:
file_diff
.
old_path
,
old_path:
file_diff
.
old_path
,
new_path:
file_diff
.
new_path
,
new_path:
file_diff
.
new_path
,
head_sha:
new_diff_refs
.
head_sha
,
head_sha:
new_diff_refs
.
head_sha
,
...
@@ -91,6 +91,13 @@ module Gitlab
...
@@ -91,6 +91,13 @@ module Gitlab
old_line:
old_line
,
old_line:
old_line
,
new_line:
new_line
new_line:
new_line
)
)
# If a position is found, but is not actually contained in the diff, for example
# because it was an unchanged line in the context of a change that was undone,
# we cannot return this as a successful trace.
return
unless
new_position
.
diff_line
(
repository
)
new_position
end
end
private
private
...
...
spec/lib/gitlab/diff/position_tracer_spec.rb
View file @
63d38a30
...
@@ -569,13 +569,8 @@ describe Gitlab::Diff::PositionTracer, lib: true do
...
@@ -569,13 +569,8 @@ describe Gitlab::Diff::PositionTracer, lib: true do
# 1 1 BB
# 1 1 BB
# 2 2 A
# 2 2 A
it
"returns the new position"
do
it
"returns nil since the line doesn't exist in the new diffs anymore"
do
expect_new_position
(
expect
(
subject
).
to
be_nil
old_path:
file_name
,
new_path:
new_file_name
,
old_line:
old_position
.
new_line
,
new_line:
old_position
.
new_line
)
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