diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2016-01-14 05:04:53 +0300 |
---|---|---|
committer | Rubén Dávila <rdavila84@gmail.com> | 2016-01-14 05:04:53 +0300 |
commit | c179b48c97be22ef55ef9f5874984f7359fb12f1 (patch) | |
tree | cb0f5c8f03df34f8735487f5ee2a5136a3b54d10 /lib/gitlab/diff | |
parent | 1161cf2ec610cb0ceba61c92180566c9786ab059 (diff) |
Use #sub instead of #gsub!. #3945
* This is because is not a good idea to modify the original lines
* Also I run into this issue https://gitlab.com/gitlab-org/gitlab_git/issues/14
which is returning Diff Lines with the same @new_pos value.
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r-- | lib/gitlab/diff/highlight.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/diff/highlight.rb b/lib/gitlab/diff/highlight.rb index f940b57d596..e76a6f27856 100644 --- a/lib/gitlab/diff/highlight.rb +++ b/lib/gitlab/diff/highlight.rb @@ -73,7 +73,7 @@ module Gitlab # Only update text if line is found. This will prevent # issues with submodules given the line only exists in diff content. - line.text = highlighted_line.gsub!(/\A\s/, line_prefix).html_safe if highlighted_line + line.text = highlighted_line.sub(/\A\s/, line_prefix).html_safe if highlighted_line end @lines |