Commit bd5334abc28ddc17b18df25cfe2fee1240d132a6

Authored by Valeriy Sizov
1 parent 2985697a

fix inline diff

Showing 1 changed file with 2 additions and 3 deletions   Show diff stats
lib/gitlab/inline_diff.rb
@@ -21,14 +21,13 @@ module Gitlab @@ -21,14 +21,13 @@ module Gitlab
21 end 21 end
22 end 22 end
23 first_token = first_line[0..first_the_same_symbols][1..-1] 23 first_token = first_line[0..first_the_same_symbols][1..-1]
24 -  
25 diff_arr[index+1].sub!(first_token, first_token + START) 24 diff_arr[index+1].sub!(first_token, first_token + START)
26 diff_arr[index+2].sub!(first_token, first_token + START) 25 diff_arr[index+2].sub!(first_token, first_token + START)
27 -  
28 last_the_same_symbols = 0 26 last_the_same_symbols = 0
29 (1..max_length + 1).each do |i| 27 (1..max_length + 1).each do |i|
30 last_the_same_symbols = -i 28 last_the_same_symbols = -i
31 - if first_line[-i] != second_line[-i] 29 + shortest_line = second_line.size > first_line.size ? first_line : second_line
  30 + if ( first_line[-i] != second_line[-i] ) || "#{first_token}#{START}".size == shortest_line[1..-i].size
32 break 31 break
33 end 32 end
34 end 33 end