diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-05-09 15:41:21 -0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-05-16 20:54:45 -0400 |
commit | 71569a9c410d297469c86227807c9f60cc069ef6 (patch) | |
tree | 8aa617510130a708ba2f7f86a867b5be19055cea | |
parent | f3cbb0a4503fca0420d8d5b276d011391ce31f6b (diff) | |
download | gitlab-ce-71569a9c410d297469c86227807c9f60cc069ef6.tar.gz |
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.
-rw-r--r-- | lib/gitlab/git/commit.rb | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index f9a9b767ef4..e14c3511e60 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -19,13 +19,7 @@ module Gitlab def ==(other) return false unless other.is_a?(Gitlab::Git::Commit) - methods = [:message, :parent_ids, :authored_date, :author_name, - :author_email, :committed_date, :committer_name, - :committer_email] - - methods.all? do |method| - send(method) == other.send(method) - end + id && id == other.id end class << self |