Merge develop to master

This commit is contained in:
Arnon Keereena 2017-05-04 22:41:38 +02:00
commit a58f849456
2 changed files with 14 additions and 12 deletions

View File

@ -47,15 +47,16 @@ public class CommitIterator: IteratorProtocol, Sequence {
} }
public func next() -> Element? { public func next() -> Element? {
var unsafeCommit: OpaquePointer? = nil
var oid = git_oid() var oid = git_oid()
let revwalkGitResult = git_revwalk_next(&oid, revisionWalker) let revwalkGitResult = git_revwalk_next(&oid, revisionWalker)
let nextResult = Next(revwalkGitResult, name: "git_revwalk_next") let nextResult = Next(revwalkGitResult, name: "git_revwalk_next")
if case let .error(error) = nextResult { switch nextResult {
case let .error(error):
return Result.failure(error) return Result.failure(error)
} else if case .over = nextResult { case .over:
return nil return nil
} case .ok:
var unsafeCommit: OpaquePointer? = nil
let lookupGitResult = git_commit_lookup(&unsafeCommit, repo.pointer, &oid) let lookupGitResult = git_commit_lookup(&unsafeCommit, repo.pointer, &oid)
guard lookupGitResult == GIT_OK.rawValue, guard lookupGitResult == GIT_OK.rawValue,
let unwrapCommit = unsafeCommit else { let unwrapCommit = unsafeCommit else {
@ -65,6 +66,7 @@ public class CommitIterator: IteratorProtocol, Sequence {
git_commit_free(unsafeCommit) git_commit_free(unsafeCommit)
return result return result
} }
}
public func makeIterator() -> CommitIterator { public func makeIterator() -> CommitIterator {
return self return self

View File

@ -601,7 +601,7 @@ class RepositorySpec: QuickSpec {
} }
} }
fdescribe("Repository.allCommits(in:)") { describe("Repository.allCommits(in:)") {
it("should return all (9) commits") { it("should return all (9) commits") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let branches = repo.localBranches().value! let branches = repo.localBranches().value!