add function to get recent commits
This commit is contained in:
parent
3e0ba8a1d5
commit
af8cd536f1
1 changed files with 16 additions and 0 deletions
|
|
@ -259,6 +259,22 @@ class PasswordStore {
|
|||
}
|
||||
}
|
||||
|
||||
func getRecentCommits(count: Int) -> [GTCommit] {
|
||||
var commits = [GTCommit]()
|
||||
do {
|
||||
let enumerator = try GTEnumerator(repository: storeRepository!)
|
||||
try enumerator.pushSHA(storeRepository!.headReference().targetOID.sha!)
|
||||
for _ in 0 ..< count {
|
||||
let commit = try enumerator.nextObject(withSuccess: nil)
|
||||
commits.append(commit)
|
||||
}
|
||||
} catch {
|
||||
print(error)
|
||||
return commits
|
||||
}
|
||||
return commits
|
||||
}
|
||||
|
||||
func fetchPasswordEntityCoreData() -> [PasswordEntity] {
|
||||
let passwordEntityFetch = NSFetchRequest<NSFetchRequestResult>(entityName: "PasswordEntity")
|
||||
do {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue