Commit 4b7e9eaa authored by Douwe Maan's avatar Douwe Maan

Treat Repository instances with the same disk path as the same hash key

parent 5f0e4040
......@@ -69,7 +69,13 @@ class Repository
end
def ==(other)
@disk_path == other.disk_path
other.is_a?(self.class) && @disk_path == other.disk_path
end
alias_method :eql?, :==
def hash
[self.class, @disk_path].hash
end
def raw_repository
......
......@@ -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`,
......
......@@ -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.
......
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