On second thought, I believe StatusEntry should not be a sub struct of Diff since it has references to two Diff Deltas but itself is not a Diff and not used by anything contained within Diff. It is conceptually different.

This commit is contained in:
Jake Van Alstyne 🎩 2017-09-08 17:13:05 -06:00
parent 3b9beac923
commit 5f4043bb0e
2 changed files with 8 additions and 9 deletions

View File

@ -7,6 +7,12 @@
//
import libgit2
public struct StatusEntry {
public var status: Diff.Status
public var headToIndex: Diff.Delta?
public var indexToWorkDir: Diff.Delta?
}
public struct Diff {
public struct File {
public var oid: OID
@ -23,12 +29,6 @@ public struct Diff {
}
}
public struct StatusEntry {
public var status: Status
public var headToIndex: Delta?
public var indexToWorkDir: Delta?
}
public struct Status: OptionSet {
// This appears to be necessary due to bug in Swift
// https://bugs.swift.org/browse/SR-3003

View File

@ -662,8 +662,7 @@ final public class Repository {
// MARK: - Status
public func status() -> Result<[Diff.StatusEntry], NSError> {
typealias StatusEntry = Diff.StatusEntry
public func status() -> Result<[StatusEntry], NSError> {
var returnArray = [StatusEntry]()
// Do this because GIT_STATUS_OPTIONS_INIT is unavailable in swift
@ -702,7 +701,7 @@ final public class Repository {
indexToWorkDir = Diff.Delta(from: itow.pointee)
}
let statusEntry = Diff.StatusEntry(status: status, headToIndex: headToIndex, indexToWorkDir: indexToWorkDir)
let statusEntry = StatusEntry(status: status, headToIndex: headToIndex, indexToWorkDir: indexToWorkDir)
returnArray.append(statusEntry)
}