Skip to content

Commit 963acb4

Browse files
armcknightAndrew McKnight
andauthored
fix(checkout): re-add removed parameter (#20)
Co-authored-by: Andrew McKnight <[email protected]>
1 parent 0464a2a commit 963acb4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Sources/GitKit/Git.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ public final class Git: Shell {
2020
case commit(message: String, allowEmpty: Bool = false, gpgSigned: Bool = false)
2121
case writeConfig(name: String, value: String)
2222
case readConfig(name: String)
23-
case checkout(branch: String, create: Bool = false)
23+
24+
/// - parameter branch the name of the branch to checkout
25+
/// - parameter create whether to create a new branch or checkout an existing one
26+
/// - parameter tracking when creating a new branch, the name of the remote branch it should track
27+
case checkout(branch: String, create: Bool = false, tracking: String? = nil)
28+
2429
case log(numberOfCommits: Int? = nil, options: [String]? = nil, revisions: String? = nil)
2530
case push(remote: String? = nil, branch: String? = nil)
2631
case pull(remote: String? = nil, branch: String? = nil, rebase: Bool = false)
@@ -73,12 +78,15 @@ public final class Git: Shell {
7378
if let dirName = dirname {
7479
params.append(dirName)
7580
}
76-
case .checkout(let branch, let create):
81+
case .checkout(let branch, let create, let tracking):
7782
params = [Command.checkout.rawValue]
7883
if create {
7984
params.append("-b")
8085
}
8186
params.append(branch)
87+
if let tracking {
88+
params.append(tracking)
89+
}
8290
case .log(let numberOfCommits, let options, let revisions):
8391
params = [Command.log.rawValue]
8492
if let numberOfCommits = numberOfCommits {

0 commit comments

Comments
 (0)