summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-03-31 17:49:43 -0600
committerDouwe Maan <douwe@selenight.nl>2017-04-08 14:37:46 -0500
commit2c0de7aaafd5fb842618bb7fa218e11255363bc8 (patch)
treec2639eb9e055ae841821db9c9cad5b634a93bb4e /lib
parentb202b42cfee6bb8cf0c142c918c545f45464a29c (diff)
downloadgitlab-ce-2c0de7aaafd5fb842618bb7fa218e11255363bc8.tar.gz
Cache MR diffs by diff refs
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/diff/diff_refs.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gitlab/diff/diff_refs.rb b/lib/gitlab/diff/diff_refs.rb
index 8406ca4269c..7948782aecc 100644
--- a/lib/gitlab/diff/diff_refs.rb
+++ b/lib/gitlab/diff/diff_refs.rb
@@ -18,6 +18,12 @@ module Gitlab
head_sha == other.head_sha
end
+ alias_method :eql?, :==
+
+ def hash
+ [base_sha, start_sha, head_sha].hash
+ end
+
# There is only one case in which we will have `start_sha` and `head_sha`,
# but not `base_sha`, which is when a diff is generated between an
# orphaned branch and another branch, which means there _is_ no base, but