forked from Carthage/Carthage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Submodule.swift
38 lines (31 loc) · 930 Bytes
/
Submodule.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/// A Git submodule.
public struct Submodule {
/// The name of the submodule. Usually (but not always) the same as the
/// path.
public let name: String
/// The relative path at which the submodule is checked out.
public let path: String
/// The URL from which the submodule should be cloned, if present.
public var url: GitURL
/// The SHA checked out in the submodule.
public var sha: String
public init(name: String, path: String, url: GitURL, sha: String) {
self.name = name
self.path = path
self.url = url
self.sha = sha
}
}
extension Submodule: Hashable {
public static func == (_ lhs: Submodule, _ rhs: Submodule) -> Bool {
return lhs.name == rhs.name && lhs.path == rhs.path && lhs.url == rhs.url && lhs.sha == rhs.sha
}
public var hashValue: Int {
return name.hashValue
}
}
extension Submodule: CustomStringConvertible {
public var description: String {
return "\(name) @ \(sha)"
}
}