diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-07-06 19:29:41 -0400 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-07-06 19:29:41 -0400 |
commit | ac26b23712963b0471db9742fc340ea4fb8935a9 (patch) | |
tree | 3eb3eea43ed5ffe83b453807ceef00488a0fe2e5 /lib | |
parent | 2db75f8debd96c48c6cb8548824dd72bd71fb176 (diff) | |
download | gitlab-ce-ac26b23712963b0471db9742fc340ea4fb8935a9.tar.gz |
Remove duplication, unused methods, and some other style things
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/diff/file.rb | 7 | ||||
-rw-r--r-- | lib/gitlab/diff/highlight.rb | 11 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb index 3941e963c03..b0c50edba59 100644 --- a/lib/gitlab/diff/file.rb +++ b/lib/gitlab/diff/file.rb @@ -21,9 +21,7 @@ module Gitlab new_path: new_path, old_line: line.old_line, new_line: line.new_line, - base_sha: diff_refs.base_sha, - start_sha: diff_refs.start_sha, - head_sha: diff_refs.head_sha + diff_refs: diff_refs ) end @@ -53,7 +51,7 @@ module Gitlab def content_commit return unless diff_refs - + repository.commit(deleted_file ? old_ref : new_ref) end @@ -121,6 +119,7 @@ module Gitlab def blob(commit = content_commit) return unless commit + repository.blob_at(commit.id, file_path) end end diff --git a/lib/gitlab/diff/highlight.rb b/lib/gitlab/diff/highlight.rb index 44ea6bf6102..649a265a02c 100644 --- a/lib/gitlab/diff/highlight.rb +++ b/lib/gitlab/diff/highlight.rb @@ -42,11 +42,12 @@ module Gitlab line_prefix = diff_line.text.match(/\A(.)/) ? $1 : ' ' - if diff_line.unchanged? || diff_line.added? - rich_line = new_lines[diff_line.new_pos - 1] - elsif diff_line.removed? - rich_line = old_lines[diff_line.old_pos - 1] - end + rich_line = + if diff_line.unchanged? || diff_line.added? + new_lines[diff_line.new_pos - 1] + elsif diff_line.removed? + old_lines[diff_line.old_pos - 1] + end # Only update text if line is found. This will prevent # issues with submodules given the line only exists in diff content. |