class Gitlab::Git::Compare
Attributes
base[R]
head[R]
straight[R]
Public Class Methods
new(repository, base, head, straight = false)
click to toggle source
# File lib/gitlab_git/compare.rb, line 6 def initialize(repository, base, head, straight = false) @repository = repository @straight = straight unless base && head @commits = [] return end @base = Gitlab::Git::Commit.find(repository, base.try(:strip)) @head = Gitlab::Git::Commit.find(repository, head.try(:strip)) @commits = [] unless @base && @head @commits = [] if same end
Public Instance Methods
commits()
click to toggle source
# File lib/gitlab_git/compare.rb, line 26 def commits return @commits if defined?(@commits) @commits = Gitlab::Git::Commit.between(@repository, @base.id, @head.id) end
diffs(options = {})
click to toggle source
# File lib/gitlab_git/compare.rb, line 32 def diffs(options = {}) unless @head && @base return Gitlab::Git::DiffCollection.new([]) end paths = options.delete(:paths) || [] options[:straight] = @straight Gitlab::Git::Diff.between(@repository, @head.id, @base.id, options, *paths) end
same()
click to toggle source
# File lib/gitlab_git/compare.rb, line 22 def same @base && @head && @base.id == @head.id end