Skip to content

Commit bf9df68

Browse files
armcknightAndrew McKnight
andauthored
Add rev-list command with some options (#9)
Co-authored-by: Andrew McKnight <git@mcknight.rocks>
1 parent 041fab9 commit bf9df68

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Sources/GitKit/Git.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public final class Git: Shell {
3232
case renameRemote(oldName: String, newName: String)
3333
case addRemote(name: String, url: String)
3434
case revParse(abbrevRef: String)
35+
case revList(branch: String, count: Bool = false, revisions: String? = nil)
3536
case raw(String)
3637
case lsRemote(url: String, limitToHeads: Bool = false)
3738

@@ -131,6 +132,14 @@ public final class Git: Shell {
131132
params = [Command.config.rawValue, "--add", name, value]
132133
case .revParse(abbrevRef: let abbrevRef):
133134
params = [Command.revParse.rawValue, "--abbrev-ref", abbrevRef]
135+
case .revList(let branch, let count, let revisions):
136+
params = [Command.revList.rawValue]
137+
if count {
138+
params.append("--count")
139+
}
140+
if let revisions = revisions {
141+
params.append(revisions)
142+
}
134143
case .lsRemote(url: let url, limitToHeads: let limitToHeads):
135144
params = [Command.lsRemote.rawValue]
136145
if limitToHeads {
@@ -214,6 +223,8 @@ public final class Git: Shell {
214223
case remote
215224
/// Get information about specific revisions
216225
case revParse = "rev-parse"
226+
/// Lists commit objects in reverse chronological order
227+
case revList = "rev-list"
217228
/// List references in a remote repository
218229
case lsRemote = "ls-remote"
219230
}

0 commit comments

Comments
 (0)