summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2018-11-23 12:27:08 +0100
committerDouwe Maan <douwe@selenight.nl>2018-11-26 11:15:18 +0100
commit4b7e9eaacd3c5ecfb6e8e28a0d36832d1627515a (patch)
tree043d0eaea7d0d4181066e6204685e35583685509 /lib
parent5f0e4040ce7d4d0019b3340dd603cc6f67dd036d (diff)
downloadgitlab-ce-4b7e9eaacd3c5ecfb6e8e28a0d36832d1627515a.tar.gz
Treat Repository instances with the same disk path as the same hash keydm-batch-loader-key
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/diff/diff_refs.rb2
-rw-r--r--lib/gitlab/git/repository.rb8
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/diff/diff_refs.rb b/lib/gitlab/diff/diff_refs.rb
index d4823f60826..dc245377ccc 100644
--- a/lib/gitlab/diff/diff_refs.rb
+++ b/lib/gitlab/diff/diff_refs.rb
@@ -23,7 +23,7 @@ module Gitlab
alias_method :eql?, :==
def hash
- [base_sha, start_sha, head_sha].hash
+ [self.class, base_sha, start_sha, head_sha].hash
end
# There is only one case in which we will have `start_sha` and `head_sha`,
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 067f4026f48..9b48031b2d3 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -80,7 +80,13 @@ module Gitlab
end
def ==(other)
- [storage, relative_path] == [other.storage, other.relative_path]
+ other.is_a?(self.class) && [storage, relative_path] == [other.storage, other.relative_path]
+ end
+
+ alias_method :eql?, :==
+
+ def hash
+ [self.class, storage, relative_path].hash
end
# This method will be removed when Gitaly reaches v1.1.