Skip to content
Snippets Groups Projects
Unverified Commit 4b7e9eaa authored by Douwe Maan's avatar Douwe Maan
Browse files

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

parent 5f0e4040
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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`,
Loading
Loading
Loading
Loading
@@ -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.
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment