Skip to content

Commit a1a7766

Browse files
committed
Fixed some small issues
1 parent ff1dd78 commit a1a7766

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

Sources/Version-Control/Base/Commands/Checkout.swift

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ public struct GitCheckout {
1313

1414
public init() {}
1515

16-
typealias ProgressCallback = (CheckoutProgress) -> Void
16+
public typealias ProgressCallback = (CheckoutProgress) -> Void
1717

18-
func getCheckoutArgs(progressCallback: ProgressCallback?) -> [String] {
18+
public func getCheckoutArgs(progressCallback: ProgressCallback?) -> [String] {
1919
var args = gitNetworkArguments
2020

2121
if let callback = progressCallback {
@@ -27,7 +27,7 @@ public struct GitCheckout {
2727
return args
2828
}
2929

30-
func getBranchCheckoutArgs(branch: GitBranch,
30+
public func getBranchCheckoutArgs(branch: GitBranch,
3131
enableRecurseSubmodulesFlag: Bool = false) -> [String] {
3232
var baseArgs: [String] = []
3333

@@ -64,7 +64,7 @@ public struct GitCheckout {
6464
}
6565
}
6666

67-
func getCheckoutOpts(directoryURL: URL,
67+
public func getCheckoutOpts(directoryURL: URL,
6868
account: IGitAccount?,
6969
title: String,
7070
target: String,
@@ -128,7 +128,8 @@ public struct GitCheckout {
128128
///
129129
/// - Warning:
130130
/// Ensure that the specified `directoryURL` exists and is a valid Git repository directory.
131-
func checkoutBranch(directoryURL: URL,
131+
@discardableResult
132+
public func checkoutBranch(directoryURL: URL,
132133
account: IGitAccount?,
133134
branch: GitBranch,
134135
progressCallback: ProgressCallback?) throws -> Bool {
@@ -152,10 +153,10 @@ public struct GitCheckout {
152153
return true
153154
}
154155

155-
func checkoutCommit(directoryURL: URL,
156-
account: IGitAccount?,
157-
commit: Commit,
158-
progressCallback: ProgressCallback?) async throws -> Bool {
156+
public func checkoutCommit(directoryURL: URL,
157+
account: IGitAccount?,
158+
commit: Commit,
159+
progressCallback: ProgressCallback?) async throws -> Bool {
159160
let opts = try getCheckoutOpts(
160161
directoryURL: directoryURL,
161162
account: account,
@@ -240,9 +241,9 @@ public struct GitCheckout {
240241
///
241242
/// - Warning:
242243
/// Ensure that the specified `directoryURL` exists and is a valid Git repository directory.
243-
func checkoutConflictedFile(directoryURL: URL,
244-
file: WorkingDirectoryFileChange,
245-
resolution: ManualConflictResolution) throws {
244+
public func checkoutConflictedFile(directoryURL: URL,
245+
file: WorkingDirectoryFileChange,
246+
resolution: ManualConflictResolution) throws {
246247
let args = [
247248
"checkout",
248249
"--\(resolution.rawValue)",

Sources/Version-Control/Base/Commands/Remote.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public struct Remote {
5050
///
5151
/// - Returns: An array of `GitRemote` objects representing the configured Git remotes for the local repository.
5252
public func getRemotes(directoryURL: URL) throws -> [GitRemote] {
53-
let result = try GitShell().git(args: ["remote", "-ve"],
53+
let result = try GitShell().git(args: ["remote", "-v"],
5454
path: directoryURL,
5555
name: #function)
5656

Sources/Version-Control/Base/Models/IGitAccount.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
/**
1111
* An account which can be used to potentially authenticate with a git server.
1212
*/
13-
struct IGitAccount {
13+
public struct IGitAccount {
1414

1515
/** The login/username to authenticate with. */
1616
let login: String

Sources/Version-Control/Base/Models/IRemote.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@ public protocol IRemote {
2020
var url: String { get }
2121
}
2222

23-
public class GitRemote: IRemote {
23+
public struct GitRemote: IRemote, Hashable {
24+
public var id: String { self.name }
2425
public var name: String
2526
public var url: String
2627

2728
init(name: String, url: String) {
2829
self.name = name
2930
self.url = url
3031
}
32+
33+
public static func == (lhs: GitRemote, rhs: GitRemote) -> Bool {
34+
return lhs.name == rhs.name
35+
}
3136
}

0 commit comments

Comments
 (0)