BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9109a207
Commit
9109a207
authored
Sep 04, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve commit diff
* show highlights when replace empty line with content * show inline diff when replace line with spaces with content
parent
62635983
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
inline_diff.rb
lib/gitlab/inline_diff.rb
+14
-2
No files found.
lib/gitlab/inline_diff.rb
View file @
9109a207
...
...
@@ -13,6 +13,9 @@ module Gitlab
second_line
=
diff_arr
[
index
+
2
]
max_length
=
[
first_line
.
size
,
second_line
.
size
].
max
# Skip inline diff if empty line was replaced with content
next
if
first_line
==
"-
\n
"
first_the_same_symbols
=
0
(
0
..
max_length
+
1
).
each
do
|
i
|
first_the_same_symbols
=
i
-
1
...
...
@@ -20,10 +23,19 @@ module Gitlab
break
end
end
first_token
=
first_line
[
0
..
first_the_same_symbols
][
1
..-
1
]
start
=
first_token
+
START
diff_arr
[
index
+
1
].
sub!
(
first_token
,
first_token
=>
start
)
diff_arr
[
index
+
2
].
sub!
(
first_token
,
first_token
=>
start
)
if
first_token
.
empty?
# In case if we remove string of spaces in commit
diff_arr
[
index
+
1
].
sub!
(
"-"
,
"-"
=>
"-
#{
START
}
"
)
diff_arr
[
index
+
2
].
sub!
(
"+"
,
"+"
=>
"+
#{
START
}
"
)
else
diff_arr
[
index
+
1
].
sub!
(
first_token
,
first_token
=>
start
)
diff_arr
[
index
+
2
].
sub!
(
first_token
,
first_token
=>
start
)
end
last_the_same_symbols
=
0
(
1
..
max_length
+
1
).
each
do
|
i
|
last_the_same_symbols
=
-
i
...
...
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