summaryrefslogtreecommitdiff
path: root/lib/gitlab/diff/position.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-09-22 11:30:37 +0200
committerDouwe Maan <douwe@selenight.nl>2017-09-25 10:22:28 +0200
commitb9857d8b662a2dbbf54f46ecdcecb44702affe55 (patch)
tree8a25798bc0c8e1c15ae414ac667ff5465f6fefa2 /lib/gitlab/diff/position.rb
parentc19d5ac1a2ac75fd7200aacae3514e5600a7f648 (diff)
downloadgitlab-ce-b9857d8b662a2dbbf54f46ecdcecb44702affe55.tar.gz
Properly compare diff refs and diff positions when shas are truncated
Diffstat (limited to 'lib/gitlab/diff/position.rb')
-rw-r--r--lib/gitlab/diff/position.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/gitlab/diff/position.rb b/lib/gitlab/diff/position.rb
index f80afb20f0c..b8db3adef0a 100644
--- a/lib/gitlab/diff/position.rb
+++ b/lib/gitlab/diff/position.rb
@@ -49,12 +49,13 @@ module Gitlab
coder['attributes'] = self.to_h
end
- def key
- @key ||= [base_sha, start_sha, head_sha, Digest::SHA1.hexdigest(old_path || ""), Digest::SHA1.hexdigest(new_path || ""), old_line, new_line]
- end
-
def ==(other)
- other.is_a?(self.class) && key == other.key
+ other.is_a?(self.class) &&
+ other.diff_refs == diff_refs &&
+ other.old_path == old_path &&
+ other.new_path == new_path &&
+ other.old_line == old_line &&
+ other.new_line == new_line
end
def to_h