提交 db40c668 编写于 作者: D Douwe Maan

Rename Diff::File {old,new}_ref to {old,new}_sha

上级 d9a0188d
......@@ -52,20 +52,20 @@ module Gitlab
def content_commit
return unless diff_refs
repository.commit(deleted_file ? old_ref : new_ref)
repository.commit(deleted_file? ? old_sha : new_sha)
end
def old_content_commit
return unless diff_refs
repository.commit(old_ref)
repository.commit(old_sha)
end
def old_ref
def old_sha
diff_refs.try(:base_sha)
end
def new_ref
def new_sha
diff_refs.try(:head_sha)
end
......
......@@ -3,7 +3,7 @@ module Gitlab
class Highlight
attr_reader :diff_file, :diff_lines, :raw_lines, :repository
delegate :old_path, :new_path, :old_ref, :new_ref, to: :diff_file, prefix: :diff
delegate :old_path, :new_path, :old_sha, :new_sha, to: :diff_file, prefix: :diff
def initialize(diff_lines, repository: nil)
@repository = repository
......@@ -61,12 +61,12 @@ module Gitlab
def old_lines
return unless diff_file
@old_lines ||= Gitlab::Highlight.highlight_lines(self.repository, diff_old_ref, diff_old_path)
@old_lines ||= Gitlab::Highlight.highlight_lines(self.repository, diff_old_sha, diff_old_path)
end
def new_lines
return unless diff_file
@new_lines ||= Gitlab::Highlight.highlight_lines(self.repository, diff_new_ref, diff_new_path)
@new_lines ||= Gitlab::Highlight.highlight_lines(self.repository, diff_new_sha, diff_new_path)
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册