summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValeriy Sizov <vsv2711@gmail.com>2012-10-04 13:28:58 +0300
committerValeriy Sizov <vsv2711@gmail.com>2012-10-04 13:28:58 +0300
commitbd5334abc28ddc17b18df25cfe2fee1240d132a6 (patch)
tree8d4ee7c0c1a006464a09ef99947c86df910db4d2
parent2985697af788c33b3d5b4731ec60e9b5055f97b5 (diff)
downloadgitlab-ce-bd5334abc28ddc17b18df25cfe2fee1240d132a6.tar.gz
fix inline diff
-rw-r--r--lib/gitlab/inline_diff.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/gitlab/inline_diff.rb b/lib/gitlab/inline_diff.rb
index 0f289a61e0e..7a0a3214aa1 100644
--- a/lib/gitlab/inline_diff.rb
+++ b/lib/gitlab/inline_diff.rb
@@ -21,14 +21,13 @@ module Gitlab
end
end
first_token = first_line[0..first_the_same_symbols][1..-1]
-
diff_arr[index+1].sub!(first_token, first_token + START)
diff_arr[index+2].sub!(first_token, first_token + START)
-
last_the_same_symbols = 0
(1..max_length + 1).each do |i|
last_the_same_symbols = -i
- if first_line[-i] != second_line[-i]
+ shortest_line = second_line.size > first_line.size ? first_line : second_line
+ if ( first_line[-i] != second_line[-i] ) || "#{first_token}#{START}".size == shortest_line[1..-i].size
break
end
end