OSDN Git Service

Fix inline diff issue. See #3150
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Wed, 12 Jun 2013 13:43:58 +0000 (16:43 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Wed, 12 Jun 2013 13:43:58 +0000 (16:43 +0300)
app/controllers/commit_controller.rb
lib/gitlab/inline_diff.rb

index 0f696ef..a164de3 100644 (file)
@@ -11,7 +11,7 @@ class CommitController < ProjectResourceController
     result = CommitLoadContext.new(project, current_user, params).execute
 
     @commit = result[:commit]
-    
+
     if @commit.nil?
       git_not_found!
       return
index b39fd0d..44cf49b 100644 (file)
@@ -21,8 +21,9 @@ 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)
+          start = first_token + START
+          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
@@ -60,8 +61,6 @@ module Gitlab
         line.gsub!(FINISH, "</span>")
         line
       end
-
     end
-
   end
 end