diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-06-28 22:49:54 +0200 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2018-06-28 22:53:35 +0200 |
commit | 26a8472d6d0aa1eb40285105a0f55f2f7d439897 (patch) | |
tree | 6a63bfe557716bf8a64bc7ce26eb6724236cc330 /lib | |
parent | 9ad97abfec59cde15b240a5e81a1b1caf1b2a4fc (diff) | |
download | gitlab-ce-26a8472d6d0aa1eb40285105a0f55f2f7d439897.tar.gz |
Don't add bottom 'match' line for deleted files
If a file is deleted, its new_pos is 0 (less than
total_blob_lines), but there is no reason to add the
bottom 'match' line in this case because there is not
extra content which could be expanded.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/diff/file.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb index 40bcfa20e7d..a9e209d5b71 100644 --- a/lib/gitlab/diff/file.rb +++ b/lib/gitlab/diff/file.rb @@ -250,7 +250,7 @@ module Gitlab last_line = lines.last - if last_line.new_pos < total_blob_lines(blob) + if last_line.new_pos < total_blob_lines(blob) && !deleted_file? match_line = Gitlab::Diff::Line.new("", 'match', nil, last_line.old_pos, last_line.new_pos) lines.push(match_line) end |