Define == for all Object types

This commit is contained in:
Matt Diephouse 2014-12-14 19:33:14 -05:00
parent cc48a9316c
commit 7ced0e30da

View File

@ -61,6 +61,10 @@ public protocol Object {
var oid: OID { get }
}
public func == <O: Object>(lhs: O, rhs: O) -> Bool {
return lhs.oid == rhs.oid
}
public struct Signature {
/// The name of the person.
public let name: String
@ -136,10 +140,6 @@ extension Commit: Hashable {
}
}
public func == (lhs: Commit, rhs: Commit) -> Bool {
return lhs.oid == rhs.oid
}
/// A git tree.
public struct Tree: Object {
/// An entry in a `Tree`.
@ -217,10 +217,6 @@ extension Tree: Hashable {
}
}
public func == (lhs: Tree, rhs: Tree) -> Bool {
return lhs.oid == rhs.oid
}
/// A git blob.
public struct Blob: Object {
/// The OID of the blob.
@ -245,10 +241,6 @@ extension Blob: Hashable {
}
}
public func == (lhs: Blob, rhs: Blob) -> Bool {
return lhs.oid == rhs.oid
}
/// An annotated git tag.
public struct Tag: Object {
/// The OID of the tag.
@ -285,7 +277,3 @@ extension Tag: Hashable {
return oid.hashValue
}
}
public func == (lhs: Tag, rhs: Tag) -> Bool {
return lhs.oid == rhs.oid
}