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
Boxiang Sun
gitlab-ce
Commits
489e1937
Commit
489e1937
authored
Jul 13, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename constant to be more descriptive
parent
e981d6cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
lib/gitlab/diff/inline_diff.rb
lib/gitlab/diff/inline_diff.rb
+2
-2
No files found.
lib/gitlab/diff/inline_diff.rb
View file @
489e1937
...
@@ -2,7 +2,7 @@ module Gitlab
...
@@ -2,7 +2,7 @@ module Gitlab
module
Diff
module
Diff
class
InlineDiff
class
InlineDiff
# Regex to find a run of deleted lines followed by the same number of added lines
# Regex to find a run of deleted lines followed by the same number of added lines
REGEX
=
%r{
LINE_PAIRS_PATTERN
=
%r{
# Runs start at the beginning of the string (the first line) or after a space (for an unchanged line)
# Runs start at the beginning of the string (the first line) or after a space (for an unchanged line)
(?:
\A
|
\s
)
(?:
\A
|
\s
)
...
@@ -72,7 +72,7 @@ module Gitlab
...
@@ -72,7 +72,7 @@ module Gitlab
line_prefixes
=
lines
.
each_with_object
(
""
)
{
|
line
,
s
|
s
<<
line
[
0
]
}.
gsub
(
/[^ +-]/
,
' '
)
line_prefixes
=
lines
.
each_with_object
(
""
)
{
|
line
,
s
|
s
<<
line
[
0
]
}.
gsub
(
/[^ +-]/
,
' '
)
changed_line_pairs
=
[]
changed_line_pairs
=
[]
line_prefixes
.
scan
(
REGEX
)
do
line_prefixes
.
scan
(
LINE_PAIRS_PATTERN
)
do
# For `"---+++"`, `begin_index == 0`, `end_index == 6`
# For `"---+++"`, `begin_index == 0`, `end_index == 6`
begin_index
,
end_index
=
Regexp
.
last_match
.
offset
(
:del_ins
)
begin_index
,
end_index
=
Regexp
.
last_match
.
offset
(
:del_ins
)
...
...
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