forked from Carthage/Carthage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gardening] Extract Submodule into its own file
- Loading branch information
Showing
3 changed files
with
42 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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)" | ||
} | ||
} |