Commit befa0b98 authored by Alejandro Rodríguez's avatar Alejandro Rodríguez

Compare ids of commits if present for equality test

This solves a problem where commits populated with Gitaly were not equal
to commits populated with Rugged. This is because Gitaly may not return
all fields of a commit for optimizations purposes, which resulted in
false negatives when comparing the same commit (commits with the same
sha) with different sources.
parent a1be15b0
...@@ -19,13 +19,7 @@ module Gitlab ...@@ -19,13 +19,7 @@ module Gitlab
def ==(other) def ==(other)
return false unless other.is_a?(Gitlab::Git::Commit) return false unless other.is_a?(Gitlab::Git::Commit)
methods = [:message, :parent_ids, :authored_date, :author_name, id && id == other.id
:author_email, :committed_date, :committer_name,
:committer_email]
methods.all? do |method|
send(method) == other.send(method)
end
end end
class << self class << self
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment