未验证 提交 4b7e9eaa 编写于 作者: D Douwe Maan

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

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册