mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
Fix build with Xcode 9.2
This commit is contained in:
parent
c5eb8036d0
commit
09ac23471b
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,9 +1,6 @@
|
||||
[submodule "External/libgit2"]
|
||||
path = External/libgit2
|
||||
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"]
|
||||
path = Carthage/Checkouts/Nimble
|
||||
url = https://github.com/Quick/Nimble.git
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
github "jspahrsummers/xcconfigs" >= 0.10
|
||||
github "Quick/Quick" ~> 1.0
|
||||
github "Quick/Nimble" ~> 5.0
|
||||
github "modocache/Guanaco" "6b85ad93b4e7fde8a59d23f94c438a97e1696293"
|
||||
github "Quick/Nimble" ~> 7.0
|
||||
github "ZipArchive/ZipArchive" ~> 1.6
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
github "Quick/Nimble" "v5.1.1"
|
||||
github "Quick/Quick" "v1.1.0"
|
||||
github "Quick/Nimble" "v7.0.3"
|
||||
github "Quick/Quick" "v1.2.0"
|
||||
github "ZipArchive/ZipArchive" "v1.8.1"
|
||||
github "antitypical/Result" "3.2.1"
|
||||
github "antitypical/Result" "3.2.4"
|
||||
github "jspahrsummers/xcconfigs" "0.10"
|
||||
github "modocache/Guanaco" "6b85ad93b4e7fde8a59d23f94c438a97e1696293"
|
||||
|
||||
1
Carthage/Checkouts/Guanaco
vendored
1
Carthage/Checkouts/Guanaco
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 6b85ad93b4e7fde8a59d23f94c438a97e1696293
|
||||
2
Carthage/Checkouts/Nimble
vendored
2
Carthage/Checkouts/Nimble
vendored
@ -1 +1 @@
|
||||
Subproject commit 3720e6b0f6de6d6435f79f8a174fb4bb92df5dc4
|
||||
Subproject commit 22800b0954c89344bb8c87f8ab93378076716fb7
|
||||
2
Carthage/Checkouts/Quick
vendored
2
Carthage/Checkouts/Quick
vendored
@ -1 +1 @@
|
||||
Subproject commit e4fa1e85c0305ba4e0866f25812d3fa398f3a048
|
||||
Subproject commit 0ff81f2c665b4381f526bd656f8708dd52a9ea2f
|
||||
2
Carthage/Checkouts/Result
vendored
2
Carthage/Checkouts/Result
vendored
@ -1 +1 @@
|
||||
Subproject commit 2af7c146071c8d8fb3953f19924ecebf15c88ea7
|
||||
Subproject commit 7477584259bfce2560a19e06ad9f71db441fff11
|
||||
@ -42,7 +42,6 @@
|
||||
621E66BF1C72958D00A0F352 /* ReferencesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */; };
|
||||
621E66C01C72958D00A0F352 /* OIDSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE70B3E61A1ACB37002C3F4E /* OIDSpec.swift */; };
|
||||
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 */; };
|
||||
621E66C51C72958D00A0F352 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC8143C1A99749D0063D88C /* Quick.framework */; };
|
||||
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 */; };
|
||||
BEE591C71ADF470500534F14 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEE591C61ADF470500534F14 /* Result.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 */; };
|
||||
DAC8143D1A99749D0063D88C /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC8143C1A99749D0063D88C /* Quick.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
@ -189,7 +187,6 @@
|
||||
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>"; };
|
||||
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>"; };
|
||||
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 */
|
||||
@ -211,7 +208,6 @@
|
||||
files = (
|
||||
621E66E61C729D9600A0F352 /* SwiftGit2.framework in Frameworks */,
|
||||
621E66C21C72958D00A0F352 /* ZipArchive.framework in Frameworks */,
|
||||
621E66C31C72958D00A0F352 /* Guanaco.framework in Frameworks */,
|
||||
621E66C41C72958D00A0F352 /* Nimble.framework in Frameworks */,
|
||||
621E66C51C72958D00A0F352 /* Quick.framework in Frameworks */,
|
||||
);
|
||||
@ -232,7 +228,6 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
62E6FD8F1C727E9C00A312B0 /* ZipArchive.framework in Frameworks */,
|
||||
DA59146D1A94549A00AED74C /* Guanaco.framework in Frameworks */,
|
||||
DA5023A01A969F1A004175D7 /* Nimble.framework in Frameworks */,
|
||||
DAC8143D1A99749D0063D88C /* Quick.framework in Frameworks */,
|
||||
BEB31F2F1A0D6F7A00F525B9 /* SwiftGit2.framework in Frameworks */,
|
||||
@ -350,7 +345,6 @@
|
||||
62E6FD8E1C727E9C00A312B0 /* ZipArchive.framework */,
|
||||
DA50239F1A969F1A004175D7 /* Nimble.framework */,
|
||||
DAC8143C1A99749D0063D88C /* Quick.framework */,
|
||||
DA59146C1A94549A00AED74C /* Guanaco.framework */,
|
||||
BEB31F341A0D6F7A00F525B9 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
|
||||
3
SwiftGit2.xcworkspace/contents.xcworkspacedata
generated
3
SwiftGit2.xcworkspace/contents.xcworkspacedata
generated
@ -13,9 +13,6 @@
|
||||
<FileRef
|
||||
location = "group:Carthage/Checkouts/Nimble/Nimble.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Carthage/Checkouts/Guanaco/Guanaco.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Carthage/Checkouts/ZipArchive/ZipArchive.xcodeproj">
|
||||
</FileRef>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import libgit2
|
||||
|
||||
/// A pointer to a git object.
|
||||
public protocol PointerType: Equatable, Hashable {
|
||||
public protocol PointerType: Hashable {
|
||||
/// The OID of the referenced object.
|
||||
var oid: OID { get }
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ import Result
|
||||
import SwiftGit2
|
||||
import Nimble
|
||||
import Quick
|
||||
import Guanaco
|
||||
|
||||
class RepositorySpec: QuickSpec {
|
||||
override func spec() {
|
||||
@ -23,20 +22,17 @@ class RepositorySpec: QuickSpec {
|
||||
it("should fail if the repo doesn't exist") {
|
||||
let url = URL(fileURLWithPath: "blah")
|
||||
let result = Repository.at(url)
|
||||
expect(result).to(haveFailed(beAnError(
|
||||
domain: equal(libGit2ErrorDomain),
|
||||
localizedDescription: match("Failed to resolve path")
|
||||
)))
|
||||
expect(result.error?.domain) == libGit2ErrorDomain
|
||||
expect(result.error?.localizedDescription).to(match("Failed to resolve path"))
|
||||
}
|
||||
}
|
||||
|
||||
describe("Repository.Type.create(at:)") {
|
||||
it("should create a new repo at the specified location") {
|
||||
let remoteRepo = Fixtures.simpleRepository
|
||||
let localURL = self.temporaryURL(forPurpose: "local-create")
|
||||
let result = Repository.create(at: localURL)
|
||||
|
||||
expect(result).to(haveSucceeded())
|
||||
expect(result.error).to(beNil())
|
||||
|
||||
if case .success(let clonedRepo) = result {
|
||||
expect(clonedRepo.directoryURL).notTo(beNil())
|
||||
@ -50,7 +46,7 @@ class RepositorySpec: QuickSpec {
|
||||
let localURL = self.temporaryURL(forPurpose: "local-clone")
|
||||
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 {
|
||||
expect(clonedRepo.directoryURL).notTo(beNil())
|
||||
@ -62,7 +58,7 @@ class RepositorySpec: QuickSpec {
|
||||
let localURL = self.temporaryURL(forPurpose: "bare-clone")
|
||||
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 {
|
||||
expect(clonedRepo.directoryURL).to(beNil())
|
||||
@ -74,11 +70,11 @@ class RepositorySpec: QuickSpec {
|
||||
let localURL = self.temporaryURL(forPurpose: "valid-remote-clone")
|
||||
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 {
|
||||
let remoteResult = clonedRepo.remote(named: "origin")
|
||||
expect(remoteResult).to(haveSucceeded())
|
||||
expect(remoteResult.error).to(beNil())
|
||||
|
||||
if case .success(let remote) = remoteResult {
|
||||
expect(remote.URL).to(equal(remoteRepo.directoryURL?.absoluteString))
|
||||
@ -91,11 +87,11 @@ class RepositorySpec: QuickSpec {
|
||||
let localURL = self.temporaryURL(forPurpose: "public-remote-clone")
|
||||
let cloneResult = Repository.clone(from: remoteRepoURL!, to: localURL)
|
||||
|
||||
expect(cloneResult).to(haveSucceeded())
|
||||
expect(cloneResult.error).to(beNil())
|
||||
|
||||
if case .success(let clonedRepo) = cloneResult {
|
||||
let remoteResult = clonedRepo.remote(named: "origin")
|
||||
expect(remoteResult).to(haveSucceeded())
|
||||
expect(remoteResult.error).to(beNil())
|
||||
|
||||
if case .success(let remote) = remoteResult {
|
||||
expect(remote.URL).to(equal(remoteRepoURL?.absoluteString))
|
||||
@ -121,11 +117,11 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
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 {
|
||||
let remoteResult = clonedRepo.remote(named: "origin")
|
||||
expect(remoteResult).to(haveSucceeded())
|
||||
expect(remoteResult.error).to(beNil())
|
||||
|
||||
if case .success(let remote) = remoteResult {
|
||||
expect(remote.URL).to(equal(remoteRepoURL?.absoluteString))
|
||||
@ -141,7 +137,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!
|
||||
|
||||
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") {
|
||||
@ -149,7 +145,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
|
||||
|
||||
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") {
|
||||
@ -158,7 +154,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
|
||||
|
||||
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 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") {
|
||||
@ -176,7 +172,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
|
||||
|
||||
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") {
|
||||
@ -185,7 +181,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
|
||||
|
||||
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 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") {
|
||||
@ -203,7 +199,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
|
||||
|
||||
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") {
|
||||
@ -212,7 +208,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
|
||||
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 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") {
|
||||
@ -230,7 +226,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
|
||||
|
||||
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") {
|
||||
@ -239,7 +235,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
|
||||
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 blob = repo.blob(oid).value
|
||||
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") {
|
||||
@ -257,7 +253,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
let commit = repo.commit(oid).value
|
||||
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") {
|
||||
@ -265,7 +261,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")!
|
||||
let tag = repo.tag(oid).value
|
||||
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") {
|
||||
@ -273,14 +269,14 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
|
||||
let tree = repo.tree(oid).value
|
||||
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") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")!
|
||||
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 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") {
|
||||
@ -300,7 +296,7 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
let pointer = PointerTo<Tree>(oid)
|
||||
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") {
|
||||
@ -309,7 +305,7 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
let pointer = PointerTo<Blob>(oid)
|
||||
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") {
|
||||
@ -318,7 +314,7 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
let pointer = PointerTo<Tag>(oid)
|
||||
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 commit = repo.commit(oid).value!
|
||||
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") {
|
||||
@ -340,7 +336,7 @@ class RepositorySpec: QuickSpec {
|
||||
let pointer = Pointer.tree(oid)
|
||||
let tree = repo.tree(oid).value!
|
||||
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") {
|
||||
@ -350,7 +346,7 @@ class RepositorySpec: QuickSpec {
|
||||
let pointer = Pointer.blob(oid)
|
||||
let blob = repo.blob(oid).value!
|
||||
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") {
|
||||
@ -360,7 +356,7 @@ class RepositorySpec: QuickSpec {
|
||||
let pointer = Pointer.tag(oid)
|
||||
let tag = repo.tag(oid).value!
|
||||
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") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let result = repo.allRemotes()
|
||||
expect(result).to(haveSucceeded(beEmpty()))
|
||||
expect(result.value) == []
|
||||
}
|
||||
|
||||
it("should return all the remotes") {
|
||||
let repo = Fixtures.mantleRepository
|
||||
let remotes = repo.allRemotes()
|
||||
let names = remotes.map { $0.map { $0.name } }
|
||||
expect(remotes.map { $0.count }).to(haveSucceeded(equal(2)))
|
||||
expect(names).to(haveSucceeded(contain("origin", "upstream")))
|
||||
expect(remotes.map { $0.count }.value) == 2
|
||||
expect(names.value).to(contain("origin", "upstream"))
|
||||
}
|
||||
}
|
||||
|
||||
@ -384,13 +380,13 @@ class RepositorySpec: QuickSpec {
|
||||
it("should return the remote if it exists") {
|
||||
let repo = Fixtures.mantleRepository
|
||||
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") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
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") {
|
||||
let name = "refs/heads/master"
|
||||
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())
|
||||
}
|
||||
|
||||
it("should return a remote branch if it exists") {
|
||||
let name = "refs/remotes/upstream/master"
|
||||
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())
|
||||
}
|
||||
|
||||
@ -424,7 +420,7 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
it("should error if the reference doesn't exist") {
|
||||
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 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.map { $0.name }).to(equal(expectedNames))
|
||||
@ -479,7 +475,7 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
it("should error if the branch doesn't exists") {
|
||||
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") {
|
||||
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") {
|
||||
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")!
|
||||
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
|
||||
expect(HEAD?.longName).to(equal("HEAD"))
|
||||
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"))
|
||||
}
|
||||
}
|
||||
@ -558,10 +554,10 @@ class RepositorySpec: QuickSpec {
|
||||
expect(repo.HEAD().value?.longName).to(equal("HEAD"))
|
||||
|
||||
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.setHEAD(oid)).to(haveSucceeded())
|
||||
expect(repo.setHEAD(oid).error).to(beNil())
|
||||
expect(repo.HEAD().value?.longName).to(equal("HEAD"))
|
||||
}
|
||||
}
|
||||
@ -576,12 +572,12 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "315b3f344221db91ddc54b269f3c9af422da0f2e")!
|
||||
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
|
||||
expect(HEAD?.longName).to(equal("HEAD"))
|
||||
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"))
|
||||
}
|
||||
|
||||
@ -592,7 +588,7 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
expect(repo.checkout(oid, strategy: .None, progress: { (_, completedSteps, totalSteps) -> Void in
|
||||
expect(completedSteps).to(beLessThanOrEqualTo(totalSteps))
|
||||
})).to(haveSucceeded())
|
||||
}).error).to(beNil())
|
||||
|
||||
let HEAD = repo.HEAD().value
|
||||
expect(HEAD?.longName).to(equal("HEAD"))
|
||||
@ -607,10 +603,10 @@ class RepositorySpec: QuickSpec {
|
||||
expect(repo.HEAD().value?.longName).to(equal("HEAD"))
|
||||
|
||||
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.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"))
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user