Fix build with Xcode 9.2

This commit is contained in:
Matt Diephouse 2017-12-14 15:08:17 -05:00
parent c5eb8036d0
commit 09ac23471b
11 changed files with 65 additions and 84 deletions

3
.gitmodules vendored
View File

@ -1,9 +1,6 @@
[submodule "External/libgit2"] [submodule "External/libgit2"]
path = External/libgit2 path = External/libgit2
url = https://github.com/libgit2/libgit2.git url = https://github.com/libgit2/libgit2.git
[submodule "Carthage/Checkouts/Guanaco"]
path = Carthage/Checkouts/Guanaco
url = https://github.com/modocache/Guanaco.git
[submodule "Carthage/Checkouts/Nimble"] [submodule "Carthage/Checkouts/Nimble"]
path = Carthage/Checkouts/Nimble path = Carthage/Checkouts/Nimble
url = https://github.com/Quick/Nimble.git url = https://github.com/Quick/Nimble.git

View File

@ -1,5 +1,4 @@
github "jspahrsummers/xcconfigs" >= 0.10 github "jspahrsummers/xcconfigs" >= 0.10
github "Quick/Quick" ~> 1.0 github "Quick/Quick" ~> 1.0
github "Quick/Nimble" ~> 5.0 github "Quick/Nimble" ~> 7.0
github "modocache/Guanaco" "6b85ad93b4e7fde8a59d23f94c438a97e1696293"
github "ZipArchive/ZipArchive" ~> 1.6 github "ZipArchive/ZipArchive" ~> 1.6

View File

@ -1,6 +1,5 @@
github "Quick/Nimble" "v5.1.1" github "Quick/Nimble" "v7.0.3"
github "Quick/Quick" "v1.1.0" github "Quick/Quick" "v1.2.0"
github "ZipArchive/ZipArchive" "v1.8.1" github "ZipArchive/ZipArchive" "v1.8.1"
github "antitypical/Result" "3.2.1" github "antitypical/Result" "3.2.4"
github "jspahrsummers/xcconfigs" "0.10" github "jspahrsummers/xcconfigs" "0.10"
github "modocache/Guanaco" "6b85ad93b4e7fde8a59d23f94c438a97e1696293"

@ -1 +0,0 @@
Subproject commit 6b85ad93b4e7fde8a59d23f94c438a97e1696293

@ -1 +1 @@
Subproject commit 3720e6b0f6de6d6435f79f8a174fb4bb92df5dc4 Subproject commit 22800b0954c89344bb8c87f8ab93378076716fb7

@ -1 +1 @@
Subproject commit e4fa1e85c0305ba4e0866f25812d3fa398f3a048 Subproject commit 0ff81f2c665b4381f526bd656f8708dd52a9ea2f

@ -1 +1 @@
Subproject commit 2af7c146071c8d8fb3953f19924ecebf15c88ea7 Subproject commit 7477584259bfce2560a19e06ad9f71db441fff11

View File

@ -42,7 +42,6 @@
621E66BF1C72958D00A0F352 /* ReferencesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */; }; 621E66BF1C72958D00A0F352 /* ReferencesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */; };
621E66C01C72958D00A0F352 /* OIDSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE70B3E61A1ACB37002C3F4E /* OIDSpec.swift */; }; 621E66C01C72958D00A0F352 /* OIDSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE70B3E61A1ACB37002C3F4E /* OIDSpec.swift */; };
621E66C21C72958D00A0F352 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62E6FD8E1C727E9C00A312B0 /* ZipArchive.framework */; }; 621E66C21C72958D00A0F352 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62E6FD8E1C727E9C00A312B0 /* ZipArchive.framework */; };
621E66C31C72958D00A0F352 /* Guanaco.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA59146C1A94549A00AED74C /* Guanaco.framework */; };
621E66C41C72958D00A0F352 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA50239F1A969F1A004175D7 /* Nimble.framework */; }; 621E66C41C72958D00A0F352 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA50239F1A969F1A004175D7 /* Nimble.framework */; };
621E66C51C72958D00A0F352 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC8143C1A99749D0063D88C /* Quick.framework */; }; 621E66C51C72958D00A0F352 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC8143C1A99749D0063D88C /* Quick.framework */; };
621E66C81C72958D00A0F352 /* detached-head.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0B1C5C1A9978890004726D /* detached-head.zip */; }; 621E66C81C72958D00A0F352 /* detached-head.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0B1C5C1A9978890004726D /* detached-head.zip */; };
@ -80,7 +79,6 @@
BECB5F701A57286200999413 /* RemotesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6F1A57286200999413 /* RemotesSpec.swift */; }; BECB5F701A57286200999413 /* RemotesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6F1A57286200999413 /* RemotesSpec.swift */; };
BEE591C71ADF470500534F14 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEE591C61ADF470500534F14 /* Result.framework */; }; BEE591C71ADF470500534F14 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEE591C61ADF470500534F14 /* Result.framework */; };
DA5023A01A969F1A004175D7 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA50239F1A969F1A004175D7 /* Nimble.framework */; }; DA5023A01A969F1A004175D7 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA50239F1A969F1A004175D7 /* Nimble.framework */; };
DA59146D1A94549A00AED74C /* Guanaco.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA59146C1A94549A00AED74C /* Guanaco.framework */; };
DA5914761A94579000AED74C /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5914751A94579000AED74C /* Errors.swift */; }; DA5914761A94579000AED74C /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5914751A94579000AED74C /* Errors.swift */; };
DAC8143D1A99749D0063D88C /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC8143C1A99749D0063D88C /* Quick.framework */; }; DAC8143D1A99749D0063D88C /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC8143C1A99749D0063D88C /* Quick.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -189,7 +187,6 @@
BECB5F6F1A57286200999413 /* RemotesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemotesSpec.swift; sourceTree = "<group>"; }; BECB5F6F1A57286200999413 /* RemotesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemotesSpec.swift; sourceTree = "<group>"; };
BEE591C61ADF470500534F14 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = "../../Library/Developer/Xcode/DerivedData/SwiftGit2-cdzquzvlxdewyddxgdgxjagqvjba/Build/Products/Debug/Result.framework"; sourceTree = "<group>"; }; BEE591C61ADF470500534F14 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = "../../Library/Developer/Xcode/DerivedData/SwiftGit2-cdzquzvlxdewyddxgdgxjagqvjba/Build/Products/Debug/Result.framework"; sourceTree = "<group>"; };
DA50239F1A969F1A004175D7 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DA50239F1A969F1A004175D7 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA59146C1A94549A00AED74C /* Guanaco.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Guanaco.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA5914751A94579000AED74C /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = "<group>"; }; DA5914751A94579000AED74C /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = "<group>"; };
DAC8143C1A99749D0063D88C /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = "../../../../Library/Developer/Xcode/DerivedData/SwiftGit2-ezqqkevntxbroughwcioyxqriijk/Build/Products/Debug/Quick.framework"; sourceTree = "<group>"; }; DAC8143C1A99749D0063D88C /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = "../../../../Library/Developer/Xcode/DerivedData/SwiftGit2-ezqqkevntxbroughwcioyxqriijk/Build/Products/Debug/Quick.framework"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -211,7 +208,6 @@
files = ( files = (
621E66E61C729D9600A0F352 /* SwiftGit2.framework in Frameworks */, 621E66E61C729D9600A0F352 /* SwiftGit2.framework in Frameworks */,
621E66C21C72958D00A0F352 /* ZipArchive.framework in Frameworks */, 621E66C21C72958D00A0F352 /* ZipArchive.framework in Frameworks */,
621E66C31C72958D00A0F352 /* Guanaco.framework in Frameworks */,
621E66C41C72958D00A0F352 /* Nimble.framework in Frameworks */, 621E66C41C72958D00A0F352 /* Nimble.framework in Frameworks */,
621E66C51C72958D00A0F352 /* Quick.framework in Frameworks */, 621E66C51C72958D00A0F352 /* Quick.framework in Frameworks */,
); );
@ -232,7 +228,6 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
62E6FD8F1C727E9C00A312B0 /* ZipArchive.framework in Frameworks */, 62E6FD8F1C727E9C00A312B0 /* ZipArchive.framework in Frameworks */,
DA59146D1A94549A00AED74C /* Guanaco.framework in Frameworks */,
DA5023A01A969F1A004175D7 /* Nimble.framework in Frameworks */, DA5023A01A969F1A004175D7 /* Nimble.framework in Frameworks */,
DAC8143D1A99749D0063D88C /* Quick.framework in Frameworks */, DAC8143D1A99749D0063D88C /* Quick.framework in Frameworks */,
BEB31F2F1A0D6F7A00F525B9 /* SwiftGit2.framework in Frameworks */, BEB31F2F1A0D6F7A00F525B9 /* SwiftGit2.framework in Frameworks */,
@ -350,7 +345,6 @@
62E6FD8E1C727E9C00A312B0 /* ZipArchive.framework */, 62E6FD8E1C727E9C00A312B0 /* ZipArchive.framework */,
DA50239F1A969F1A004175D7 /* Nimble.framework */, DA50239F1A969F1A004175D7 /* Nimble.framework */,
DAC8143C1A99749D0063D88C /* Quick.framework */, DAC8143C1A99749D0063D88C /* Quick.framework */,
DA59146C1A94549A00AED74C /* Guanaco.framework */,
BEB31F341A0D6F7A00F525B9 /* Info.plist */, BEB31F341A0D6F7A00F525B9 /* Info.plist */,
); );
name = "Supporting Files"; name = "Supporting Files";

View File

@ -13,9 +13,6 @@
<FileRef <FileRef
location = "group:Carthage/Checkouts/Nimble/Nimble.xcodeproj"> location = "group:Carthage/Checkouts/Nimble/Nimble.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Carthage/Checkouts/Guanaco/Guanaco.xcodeproj">
</FileRef>
<FileRef <FileRef
location = "group:Carthage/Checkouts/ZipArchive/ZipArchive.xcodeproj"> location = "group:Carthage/Checkouts/ZipArchive/ZipArchive.xcodeproj">
</FileRef> </FileRef>

View File

@ -9,7 +9,7 @@
import libgit2 import libgit2
/// A pointer to a git object. /// A pointer to a git object.
public protocol PointerType: Equatable, Hashable { public protocol PointerType: Hashable {
/// The OID of the referenced object. /// The OID of the referenced object.
var oid: OID { get } var oid: OID { get }

View File

@ -10,7 +10,6 @@ import Result
import SwiftGit2 import SwiftGit2
import Nimble import Nimble
import Quick import Quick
import Guanaco
class RepositorySpec: QuickSpec { class RepositorySpec: QuickSpec {
override func spec() { override func spec() {
@ -23,20 +22,17 @@ class RepositorySpec: QuickSpec {
it("should fail if the repo doesn't exist") { it("should fail if the repo doesn't exist") {
let url = URL(fileURLWithPath: "blah") let url = URL(fileURLWithPath: "blah")
let result = Repository.at(url) let result = Repository.at(url)
expect(result).to(haveFailed(beAnError( expect(result.error?.domain) == libGit2ErrorDomain
domain: equal(libGit2ErrorDomain), expect(result.error?.localizedDescription).to(match("Failed to resolve path"))
localizedDescription: match("Failed to resolve path")
)))
} }
} }
describe("Repository.Type.create(at:)") { describe("Repository.Type.create(at:)") {
it("should create a new repo at the specified location") { it("should create a new repo at the specified location") {
let remoteRepo = Fixtures.simpleRepository
let localURL = self.temporaryURL(forPurpose: "local-create") let localURL = self.temporaryURL(forPurpose: "local-create")
let result = Repository.create(at: localURL) let result = Repository.create(at: localURL)
expect(result).to(haveSucceeded()) expect(result.error).to(beNil())
if case .success(let clonedRepo) = result { if case .success(let clonedRepo) = result {
expect(clonedRepo.directoryURL).notTo(beNil()) expect(clonedRepo.directoryURL).notTo(beNil())
@ -50,7 +46,7 @@ class RepositorySpec: QuickSpec {
let localURL = self.temporaryURL(forPurpose: "local-clone") let localURL = self.temporaryURL(forPurpose: "local-clone")
let result = Repository.clone(from: remoteRepo.directoryURL!, to: localURL, localClone: true) let result = Repository.clone(from: remoteRepo.directoryURL!, to: localURL, localClone: true)
expect(result).to(haveSucceeded()) expect(result.error).to(beNil())
if case .success(let clonedRepo) = result { if case .success(let clonedRepo) = result {
expect(clonedRepo.directoryURL).notTo(beNil()) expect(clonedRepo.directoryURL).notTo(beNil())
@ -62,7 +58,7 @@ class RepositorySpec: QuickSpec {
let localURL = self.temporaryURL(forPurpose: "bare-clone") let localURL = self.temporaryURL(forPurpose: "bare-clone")
let result = Repository.clone(from: remoteRepo.directoryURL!, to: localURL, localClone: true, bare: true) let result = Repository.clone(from: remoteRepo.directoryURL!, to: localURL, localClone: true, bare: true)
expect(result).to(haveSucceeded()) expect(result.error).to(beNil())
if case .success(let clonedRepo) = result { if case .success(let clonedRepo) = result {
expect(clonedRepo.directoryURL).to(beNil()) expect(clonedRepo.directoryURL).to(beNil())
@ -74,11 +70,11 @@ class RepositorySpec: QuickSpec {
let localURL = self.temporaryURL(forPurpose: "valid-remote-clone") let localURL = self.temporaryURL(forPurpose: "valid-remote-clone")
let cloneResult = Repository.clone(from: remoteRepo.directoryURL!, to: localURL, localClone: true) let cloneResult = Repository.clone(from: remoteRepo.directoryURL!, to: localURL, localClone: true)
expect(cloneResult).to(haveSucceeded()) expect(cloneResult.error).to(beNil())
if case .success(let clonedRepo) = cloneResult { if case .success(let clonedRepo) = cloneResult {
let remoteResult = clonedRepo.remote(named: "origin") let remoteResult = clonedRepo.remote(named: "origin")
expect(remoteResult).to(haveSucceeded()) expect(remoteResult.error).to(beNil())
if case .success(let remote) = remoteResult { if case .success(let remote) = remoteResult {
expect(remote.URL).to(equal(remoteRepo.directoryURL?.absoluteString)) expect(remote.URL).to(equal(remoteRepo.directoryURL?.absoluteString))
@ -91,11 +87,11 @@ class RepositorySpec: QuickSpec {
let localURL = self.temporaryURL(forPurpose: "public-remote-clone") let localURL = self.temporaryURL(forPurpose: "public-remote-clone")
let cloneResult = Repository.clone(from: remoteRepoURL!, to: localURL) let cloneResult = Repository.clone(from: remoteRepoURL!, to: localURL)
expect(cloneResult).to(haveSucceeded()) expect(cloneResult.error).to(beNil())
if case .success(let clonedRepo) = cloneResult { if case .success(let clonedRepo) = cloneResult {
let remoteResult = clonedRepo.remote(named: "origin") let remoteResult = clonedRepo.remote(named: "origin")
expect(remoteResult).to(haveSucceeded()) expect(remoteResult.error).to(beNil())
if case .success(let remote) = remoteResult { if case .success(let remote) = remoteResult {
expect(remote.URL).to(equal(remoteRepoURL?.absoluteString)) expect(remote.URL).to(equal(remoteRepoURL?.absoluteString))
@ -121,11 +117,11 @@ class RepositorySpec: QuickSpec {
let cloneResult = Repository.clone(from: remoteRepoURL!, to: localURL, credentials: credentials) let cloneResult = Repository.clone(from: remoteRepoURL!, to: localURL, credentials: credentials)
expect(cloneResult).to(haveSucceeded()) expect(cloneResult.error).to(beNil())
if case .success(let clonedRepo) = cloneResult { if case .success(let clonedRepo) = cloneResult {
let remoteResult = clonedRepo.remote(named: "origin") let remoteResult = clonedRepo.remote(named: "origin")
expect(remoteResult).to(haveSucceeded()) expect(remoteResult.error).to(beNil())
if case .success(let remote) = remoteResult { if case .success(let remote) = remoteResult {
expect(remote.URL).to(equal(remoteRepoURL?.absoluteString)) expect(remote.URL).to(equal(remoteRepoURL?.absoluteString))
@ -141,7 +137,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")! let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!
let result = repo.blob(oid) let result = repo.blob(oid)
expect(result.map { $0.oid }).to(haveSucceeded(equal(oid))) expect(result.map { $0.oid }.value) == oid
} }
it("should error if the blob doesn't exist") { it("should error if the blob doesn't exist") {
@ -149,7 +145,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")! let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
let result = repo.blob(oid) let result = repo.blob(oid)
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
it("should error if the oid doesn't point to a blob") { it("should error if the oid doesn't point to a blob") {
@ -158,7 +154,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")! let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
let result = repo.blob(oid) let result = repo.blob(oid)
expect(result).to(haveFailed()) expect(result.error).notTo(beNil())
} }
} }
@ -168,7 +164,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
let result = repo.commit(oid) let result = repo.commit(oid)
expect(result.map { $0.oid }).to(haveSucceeded(equal(oid))) expect(result.map { $0.oid }.value) == oid
} }
it("should error if the commit doesn't exist") { it("should error if the commit doesn't exist") {
@ -176,7 +172,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")! let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
let result = repo.commit(oid) let result = repo.commit(oid)
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
it("should error if the oid doesn't point to a commit") { it("should error if the oid doesn't point to a commit") {
@ -185,7 +181,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")! let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
let result = repo.commit(oid) let result = repo.commit(oid)
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
} }
@ -195,7 +191,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")! let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")!
let result = repo.tag(oid) let result = repo.tag(oid)
expect(result.map { $0.oid }).to(haveSucceeded(equal(oid))) expect(result.map { $0.oid }.value) == oid
} }
it("should error if the tag doesn't exist") { it("should error if the tag doesn't exist") {
@ -203,7 +199,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")! let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
let result = repo.tag(oid) let result = repo.tag(oid)
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
it("should error if the oid doesn't point to a tag") { it("should error if the oid doesn't point to a tag") {
@ -212,7 +208,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
let result = repo.tag(oid) let result = repo.tag(oid)
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
} }
@ -222,7 +218,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")! let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
let result = repo.tree(oid) let result = repo.tree(oid)
expect(result.map { $0.oid }).to(haveSucceeded(equal(oid))) expect(result.map { $0.oid }.value) == oid
} }
it("should error if the tree doesn't exist") { it("should error if the tree doesn't exist") {
@ -230,7 +226,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")! let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
let result = repo.tree(oid) let result = repo.tree(oid)
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
it("should error if the oid doesn't point to a tree") { it("should error if the oid doesn't point to a tree") {
@ -239,7 +235,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
let result = repo.tree(oid) let result = repo.tree(oid)
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
} }
@ -249,7 +245,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")! let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!
let blob = repo.blob(oid).value let blob = repo.blob(oid).value
let result = repo.object(oid) let result = repo.object(oid)
expect(result.map { $0 as! Blob }).to(haveSucceeded(equal(blob))) expect(result.map { $0 as! Blob }.value) == blob
} }
it("should work with a commit") { it("should work with a commit") {
@ -257,7 +253,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
let commit = repo.commit(oid).value let commit = repo.commit(oid).value
let result = repo.object(oid) let result = repo.object(oid)
expect(result.map { $0 as! Commit }).to(haveSucceeded(equal(commit))) expect(result.map { $0 as! Commit }.value) == commit
} }
it("should work with a tag") { it("should work with a tag") {
@ -265,7 +261,7 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")! let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")!
let tag = repo.tag(oid).value let tag = repo.tag(oid).value
let result = repo.object(oid) let result = repo.object(oid)
expect(result.map { $0 as! Tag }).to(haveSucceeded(equal(tag))) expect(result.map { $0 as! Tag }.value) == tag
} }
it("should work with a tree") { it("should work with a tree") {
@ -273,14 +269,14 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")! let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
let tree = repo.tree(oid).value let tree = repo.tree(oid).value
let result = repo.object(oid) let result = repo.object(oid)
expect(result.map { $0 as! Tree }).to(haveSucceeded(equal(tree))) expect(result.map { $0 as! Tree }.value) == tree
} }
it("should error if there's no object with that oid") { it("should error if there's no object with that oid") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")! let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
let result = repo.object(oid) let result = repo.object(oid)
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
} }
@ -291,7 +287,7 @@ class RepositorySpec: QuickSpec {
let pointer = PointerTo<Commit>(oid) let pointer = PointerTo<Commit>(oid)
let commit = repo.commit(oid).value! let commit = repo.commit(oid).value!
expect(repo.object(from: pointer)).to(haveSucceeded(equal(commit))) expect(repo.object(from: pointer).value) == commit
} }
it("should work with trees") { it("should work with trees") {
@ -300,7 +296,7 @@ class RepositorySpec: QuickSpec {
let pointer = PointerTo<Tree>(oid) let pointer = PointerTo<Tree>(oid)
let tree = repo.tree(oid).value! let tree = repo.tree(oid).value!
expect(repo.object(from: pointer)).to(haveSucceeded(equal(tree))) expect(repo.object(from: pointer).value) == tree
} }
it("should work with blobs") { it("should work with blobs") {
@ -309,7 +305,7 @@ class RepositorySpec: QuickSpec {
let pointer = PointerTo<Blob>(oid) let pointer = PointerTo<Blob>(oid)
let blob = repo.blob(oid).value! let blob = repo.blob(oid).value!
expect(repo.object(from: pointer)).to(haveSucceeded(equal(blob))) expect(repo.object(from: pointer).value) == blob
} }
it("should work with tags") { it("should work with tags") {
@ -318,7 +314,7 @@ class RepositorySpec: QuickSpec {
let pointer = PointerTo<Tag>(oid) let pointer = PointerTo<Tag>(oid)
let tag = repo.tag(oid).value! let tag = repo.tag(oid).value!
expect(repo.object(from: pointer)).to(haveSucceeded(equal(tag))) expect(repo.object(from: pointer).value) == tag
} }
} }
@ -330,7 +326,7 @@ class RepositorySpec: QuickSpec {
let pointer = Pointer.commit(oid) let pointer = Pointer.commit(oid)
let commit = repo.commit(oid).value! let commit = repo.commit(oid).value!
let result = repo.object(from: pointer).map { $0 as! Commit } let result = repo.object(from: pointer).map { $0 as! Commit }
expect(result).to(haveSucceeded(equal(commit))) expect(result.value) == commit
} }
it("should work with trees") { it("should work with trees") {
@ -340,7 +336,7 @@ class RepositorySpec: QuickSpec {
let pointer = Pointer.tree(oid) let pointer = Pointer.tree(oid)
let tree = repo.tree(oid).value! let tree = repo.tree(oid).value!
let result = repo.object(from: pointer).map { $0 as! Tree } let result = repo.object(from: pointer).map { $0 as! Tree }
expect(result).to(haveSucceeded(equal(tree))) expect(result.value) == tree
} }
it("should work with blobs") { it("should work with blobs") {
@ -350,7 +346,7 @@ class RepositorySpec: QuickSpec {
let pointer = Pointer.blob(oid) let pointer = Pointer.blob(oid)
let blob = repo.blob(oid).value! let blob = repo.blob(oid).value!
let result = repo.object(from: pointer).map { $0 as! Blob } let result = repo.object(from: pointer).map { $0 as! Blob }
expect(result).to(haveSucceeded(equal(blob))) expect(result.value) == blob
} }
it("should work with tags") { it("should work with tags") {
@ -360,7 +356,7 @@ class RepositorySpec: QuickSpec {
let pointer = Pointer.tag(oid) let pointer = Pointer.tag(oid)
let tag = repo.tag(oid).value! let tag = repo.tag(oid).value!
let result = repo.object(from: pointer).map { $0 as! Tag } let result = repo.object(from: pointer).map { $0 as! Tag }
expect(result).to(haveSucceeded(equal(tag))) expect(result.value) == tag
} }
} }
@ -368,15 +364,15 @@ class RepositorySpec: QuickSpec {
it("should return an empty list if there are no remotes") { it("should return an empty list if there are no remotes") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let result = repo.allRemotes() let result = repo.allRemotes()
expect(result).to(haveSucceeded(beEmpty())) expect(result.value) == []
} }
it("should return all the remotes") { it("should return all the remotes") {
let repo = Fixtures.mantleRepository let repo = Fixtures.mantleRepository
let remotes = repo.allRemotes() let remotes = repo.allRemotes()
let names = remotes.map { $0.map { $0.name } } let names = remotes.map { $0.map { $0.name } }
expect(remotes.map { $0.count }).to(haveSucceeded(equal(2))) expect(remotes.map { $0.count }.value) == 2
expect(names).to(haveSucceeded(contain("origin", "upstream"))) expect(names.value).to(contain("origin", "upstream"))
} }
} }
@ -384,13 +380,13 @@ class RepositorySpec: QuickSpec {
it("should return the remote if it exists") { it("should return the remote if it exists") {
let repo = Fixtures.mantleRepository let repo = Fixtures.mantleRepository
let result = repo.remote(named: "upstream") let result = repo.remote(named: "upstream")
expect(result.map { $0.name }).to(haveSucceeded(equal("upstream"))) expect(result.map { $0.name }.value) == "upstream"
} }
it("should error if the remote doesn't exist") { it("should error if the remote doesn't exist") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let result = repo.remote(named: "nonexistent") let result = repo.remote(named: "nonexistent")
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
} }
@ -398,14 +394,14 @@ class RepositorySpec: QuickSpec {
it("should return a local branch if it exists") { it("should return a local branch if it exists") {
let name = "refs/heads/master" let name = "refs/heads/master"
let result = Fixtures.simpleRepository.reference(named: name) let result = Fixtures.simpleRepository.reference(named: name)
expect(result.map { $0.longName }).to(haveSucceeded(equal(name))) expect(result.map { $0.longName }.value) == name
expect(result.value as? Branch).notTo(beNil()) expect(result.value as? Branch).notTo(beNil())
} }
it("should return a remote branch if it exists") { it("should return a remote branch if it exists") {
let name = "refs/remotes/upstream/master" let name = "refs/remotes/upstream/master"
let result = Fixtures.mantleRepository.reference(named: name) let result = Fixtures.mantleRepository.reference(named: name)
expect(result.map { $0.longName }).to(haveSucceeded(equal(name))) expect(result.map { $0.longName }.value) == name
expect(result.value as? Branch).notTo(beNil()) expect(result.value as? Branch).notTo(beNil())
} }
@ -424,7 +420,7 @@ class RepositorySpec: QuickSpec {
it("should error if the reference doesn't exist") { it("should error if the reference doesn't exist") {
let result = Fixtures.simpleRepository.reference(named: "refs/heads/nonexistent") let result = Fixtures.simpleRepository.reference(named: "refs/heads/nonexistent")
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
} }
@ -464,7 +460,7 @@ class RepositorySpec: QuickSpec {
] ]
let expected = expectedNames.map { repo.remoteBranch(named: $0).value! } let expected = expectedNames.map { repo.remoteBranch(named: $0).value! }
let actual = repo.remoteBranches().value!.sorted { let actual = repo.remoteBranches().value!.sorted {
return $0.longName.characters.lexicographicallyPrecedes($1.longName.characters) return $0.longName.lexicographicallyPrecedes($1.longName)
} }
expect(actual).to(equal(expected)) expect(actual).to(equal(expected))
expect(actual.map { $0.name }).to(equal(expectedNames)) expect(actual.map { $0.name }).to(equal(expectedNames))
@ -479,7 +475,7 @@ class RepositorySpec: QuickSpec {
it("should error if the branch doesn't exists") { it("should error if the branch doesn't exists") {
let result = Fixtures.simpleRepository.localBranch(named: "nonexistent") let result = Fixtures.simpleRepository.localBranch(named: "nonexistent")
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
} }
@ -491,7 +487,7 @@ class RepositorySpec: QuickSpec {
it("should error if the branch doesn't exists") { it("should error if the branch doesn't exists") {
let result = Fixtures.simpleRepository.remoteBranch(named: "origin/nonexistent") let result = Fixtures.simpleRepository.remoteBranch(named: "origin/nonexistent")
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
} }
@ -514,7 +510,7 @@ class RepositorySpec: QuickSpec {
it("should error if the branch doesn't exists") { it("should error if the branch doesn't exists") {
let result = Fixtures.simpleRepository.tag(named: "nonexistent") let result = Fixtures.simpleRepository.tag(named: "nonexistent")
expect(result).to(haveFailed(beAnError(domain: equal(libGit2ErrorDomain)))) expect(result.error?.domain) == libGit2ErrorDomain
} }
} }
@ -541,12 +537,12 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "315b3f344221db91ddc54b269f3c9af422da0f2e")! let oid = OID(string: "315b3f344221db91ddc54b269f3c9af422da0f2e")!
expect(repo.HEAD().value?.shortName).to(equal("master")) expect(repo.HEAD().value?.shortName).to(equal("master"))
expect(repo.setHEAD(oid)).to(haveSucceeded()) expect(repo.setHEAD(oid).error).to(beNil())
let HEAD = repo.HEAD().value let HEAD = repo.HEAD().value
expect(HEAD?.longName).to(equal("HEAD")) expect(HEAD?.longName).to(equal("HEAD"))
expect(HEAD?.oid).to(equal(oid)) expect(HEAD?.oid).to(equal(oid))
expect(repo.setHEAD(repo.localBranch(named: "master").value!)).to(haveSucceeded()) expect(repo.setHEAD(repo.localBranch(named: "master").value!).error).to(beNil())
expect(repo.HEAD().value?.shortName).to(equal("master")) expect(repo.HEAD().value?.shortName).to(equal("master"))
} }
} }
@ -558,10 +554,10 @@ class RepositorySpec: QuickSpec {
expect(repo.HEAD().value?.longName).to(equal("HEAD")) expect(repo.HEAD().value?.longName).to(equal("HEAD"))
let branch = repo.localBranch(named: "another-branch").value! let branch = repo.localBranch(named: "another-branch").value!
expect(repo.setHEAD(branch)).to(haveSucceeded()) expect(repo.setHEAD(branch).error).to(beNil())
expect(repo.HEAD().value?.shortName).to(equal(branch.name)) expect(repo.HEAD().value?.shortName).to(equal(branch.name))
expect(repo.setHEAD(oid)).to(haveSucceeded()) expect(repo.setHEAD(oid).error).to(beNil())
expect(repo.HEAD().value?.longName).to(equal("HEAD")) expect(repo.HEAD().value?.longName).to(equal("HEAD"))
} }
} }
@ -576,12 +572,12 @@ class RepositorySpec: QuickSpec {
let oid = OID(string: "315b3f344221db91ddc54b269f3c9af422da0f2e")! let oid = OID(string: "315b3f344221db91ddc54b269f3c9af422da0f2e")!
expect(repo.HEAD().value?.shortName).to(equal("master")) expect(repo.HEAD().value?.shortName).to(equal("master"))
expect(repo.checkout(oid, strategy: CheckoutStrategy.None)).to(haveSucceeded()) expect(repo.checkout(oid, strategy: CheckoutStrategy.None).error).to(beNil())
let HEAD = repo.HEAD().value let HEAD = repo.HEAD().value
expect(HEAD?.longName).to(equal("HEAD")) expect(HEAD?.longName).to(equal("HEAD"))
expect(HEAD?.oid).to(equal(oid)) expect(HEAD?.oid).to(equal(oid))
expect(repo.checkout(repo.localBranch(named: "master").value!, strategy: CheckoutStrategy.None)).to(haveSucceeded()) expect(repo.checkout(repo.localBranch(named: "master").value!, strategy: CheckoutStrategy.None).error).to(beNil())
expect(repo.HEAD().value?.shortName).to(equal("master")) expect(repo.HEAD().value?.shortName).to(equal("master"))
} }
@ -592,7 +588,7 @@ class RepositorySpec: QuickSpec {
expect(repo.checkout(oid, strategy: .None, progress: { (_, completedSteps, totalSteps) -> Void in expect(repo.checkout(oid, strategy: .None, progress: { (_, completedSteps, totalSteps) -> Void in
expect(completedSteps).to(beLessThanOrEqualTo(totalSteps)) expect(completedSteps).to(beLessThanOrEqualTo(totalSteps))
})).to(haveSucceeded()) }).error).to(beNil())
let HEAD = repo.HEAD().value let HEAD = repo.HEAD().value
expect(HEAD?.longName).to(equal("HEAD")) expect(HEAD?.longName).to(equal("HEAD"))
@ -607,10 +603,10 @@ class RepositorySpec: QuickSpec {
expect(repo.HEAD().value?.longName).to(equal("HEAD")) expect(repo.HEAD().value?.longName).to(equal("HEAD"))
let branch = repo.localBranch(named: "another-branch").value! let branch = repo.localBranch(named: "another-branch").value!
expect(repo.checkout(branch, strategy: CheckoutStrategy.None)).to(haveSucceeded()) expect(repo.checkout(branch, strategy: CheckoutStrategy.None).error).to(beNil())
expect(repo.HEAD().value?.shortName).to(equal(branch.name)) expect(repo.HEAD().value?.shortName).to(equal(branch.name))
expect(repo.checkout(oid, strategy: CheckoutStrategy.None)).to(haveSucceeded()) expect(repo.checkout(oid, strategy: CheckoutStrategy.None).error).to(beNil())
expect(repo.HEAD().value?.longName).to(equal("HEAD")) expect(repo.HEAD().value?.longName).to(equal("HEAD"))
} }
} }