mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
init a StatusEntry with an initializer that takes in a git_status_entry
This commit is contained in:
parent
5f4043bb0e
commit
d7154e6f40
@ -11,6 +11,18 @@ public struct StatusEntry {
|
|||||||
public var status: Diff.Status
|
public var status: Diff.Status
|
||||||
public var headToIndex: Diff.Delta?
|
public var headToIndex: Diff.Delta?
|
||||||
public var indexToWorkDir: Diff.Delta?
|
public var indexToWorkDir: Diff.Delta?
|
||||||
|
|
||||||
|
public init(from statusEntry: git_status_entry) {
|
||||||
|
self.status = Diff.Status(rawValue: statusEntry.status.rawValue)
|
||||||
|
|
||||||
|
if let htoi = statusEntry.head_to_index {
|
||||||
|
self.headToIndex = Diff.Delta(from: htoi.pointee)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let itow = statusEntry.index_to_workdir {
|
||||||
|
self.indexToWorkDir = Diff.Delta(from: itow.pointee)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct Diff {
|
public struct Diff {
|
||||||
|
|||||||
@ -688,20 +688,7 @@ final public class Repository {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var headToIndex: Diff.Delta? = nil
|
let statusEntry = StatusEntry(from: (s?.pointee)!)
|
||||||
var indexToWorkDir: Diff.Delta? = nil
|
|
||||||
|
|
||||||
let status = Diff.Status(rawValue: (s?.pointee.status.rawValue)!)
|
|
||||||
|
|
||||||
if let htoi = s?.pointee.head_to_index {
|
|
||||||
headToIndex = Diff.Delta(from: htoi.pointee)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let itow = s?.pointee.index_to_workdir {
|
|
||||||
indexToWorkDir = Diff.Delta(from: itow.pointee)
|
|
||||||
}
|
|
||||||
|
|
||||||
let statusEntry = StatusEntry(status: status, headToIndex: headToIndex, indexToWorkDir: indexToWorkDir)
|
|
||||||
returnArray.append(statusEntry)
|
returnArray.append(statusEntry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user