mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
Support Swift 1.2
- Update Guanaco, LlamaKit, Nimble, and Quick to versions that support Swift 1.2. - Update Xcode project and scheme files for "latest Xcode version" parameters. - Use Swift 1.2's new fallible casts for casts that may fail at runtime.
This commit is contained in:
parent
5af50ab922
commit
ba9a951b62
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,9 +1,6 @@
|
||||
[submodule "External/Configuration"]
|
||||
path = External/Configuration
|
||||
url = https://github.com/jspahrsummers/xcconfigs.git
|
||||
[submodule "External/Quick"]
|
||||
path = External/Quick
|
||||
url = https://github.com/github/Quick.git
|
||||
[submodule "External/libgit2"]
|
||||
path = External/libgit2
|
||||
url = https://github.com/libgit2/libgit2.git
|
||||
@ -16,3 +13,6 @@
|
||||
[submodule "External/Nimble"]
|
||||
path = External/Nimble
|
||||
url = https://github.com/Quick/Nimble.git
|
||||
[submodule "External/Quick"]
|
||||
path = External/Quick
|
||||
url = https://github.com/Quick/Quick.git
|
||||
|
||||
2
External/Guanaco
vendored
2
External/Guanaco
vendored
@ -1 +1 @@
|
||||
Subproject commit 7961d9851d72e2c8c8e2c620054041c6217806e7
|
||||
Subproject commit 18126c0c8ba9a7cb3cc5d43aec83c81047410ab6
|
||||
2
External/LlamaKit
vendored
2
External/LlamaKit
vendored
@ -1 +1 @@
|
||||
Subproject commit e37b966998df6ca05445c0b5d9c6c9560f1e7b61
|
||||
Subproject commit e28d7f6e82fbd5dcd5388b36e2acf4eedb44b4e8
|
||||
2
External/Nimble
vendored
2
External/Nimble
vendored
@ -1 +1 @@
|
||||
Subproject commit 9538a301d5320fd607f01c931dc282868b0e827a
|
||||
Subproject commit 6c1fa5137c585e6e78c4e63302850828e39365d0
|
||||
2
External/Quick
vendored
2
External/Quick
vendored
@ -1 +1 @@
|
||||
Subproject commit 3d22cf4d05f4fe965b8a607ea2c7efcb70d5d3d6
|
||||
Subproject commit 2103cf332b2bb8b85b0b25a85cc81514d03612a5
|
||||
@ -26,7 +26,6 @@
|
||||
BEB31F2F1A0D6F7A00F525B9 /* SwiftGit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB31F231A0D6F7A00F525B9 /* SwiftGit2.framework */; };
|
||||
BEB31F361A0D6F7A00F525B9 /* RepositorySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB31F351A0D6F7A00F525B9 /* RepositorySpec.swift */; };
|
||||
BEB31F6D1A0D78F300F525B9 /* Repository.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB31F6C1A0D78F300F525B9 /* Repository.swift */; };
|
||||
BEB31F7F1A0D79C800F525B9 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB31F7E1A0D79C800F525B9 /* Quick.framework */; };
|
||||
BEB31F9E1A0E595100F525B9 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB31F9D1A0E595100F525B9 /* libiconv.dylib */; };
|
||||
BEB31FA01A0E595600F525B9 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB31F9F1A0E595600F525B9 /* libz.dylib */; };
|
||||
BECB5F6A1A56F19900999413 /* References.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F691A56F19900999413 /* References.swift */; };
|
||||
@ -36,6 +35,7 @@
|
||||
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 */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -109,7 +109,6 @@
|
||||
BEB31F571A0D75EE00F525B9 /* Mac-StaticLibrary.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Mac-StaticLibrary.xcconfig"; sourceTree = "<group>"; };
|
||||
BEB31F581A0D75EE00F525B9 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||
BEB31F6C1A0D78F300F525B9 /* Repository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repository.swift; sourceTree = "<group>"; };
|
||||
BEB31F7E1A0D79C800F525B9 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = "../../../Library/Developer/Xcode/DerivedData/SwiftGit2-hhirbsygtzljdvasajovfqnfzwwb/Build/Products/Debug/Quick.framework"; sourceTree = "<group>"; };
|
||||
BEB31F8F1A0E563900F525B9 /* liblibgit2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblibgit2.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BEB31F9B1A0E581400F525B9 /* git2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = git2.h; path = External/libgit2/include/git2.h; sourceTree = "<group>"; };
|
||||
BEB31F9D1A0E595100F525B9 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; };
|
||||
@ -121,6 +120,7 @@
|
||||
DA50239F1A969F1A004175D7 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = ../External/Nimble/build/Debug/Nimble.framework; sourceTree = "<group>"; };
|
||||
DA59146C1A94549A00AED74C /* Guanaco.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Guanaco.framework; path = ../External/Guanaco/build/Debug/Guanaco.framework; 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>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -140,7 +140,7 @@
|
||||
files = (
|
||||
DA59146D1A94549A00AED74C /* Guanaco.framework in Frameworks */,
|
||||
DA5023A01A969F1A004175D7 /* Nimble.framework in Frameworks */,
|
||||
BEB31F7F1A0D79C800F525B9 /* Quick.framework in Frameworks */,
|
||||
DAC8143D1A99749D0063D88C /* Quick.framework in Frameworks */,
|
||||
BEB31F2F1A0D6F7A00F525B9 /* SwiftGit2.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -227,7 +227,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DA50239F1A969F1A004175D7 /* Nimble.framework */,
|
||||
BEB31F7E1A0D79C800F525B9 /* Quick.framework */,
|
||||
DAC8143C1A99749D0063D88C /* Quick.framework */,
|
||||
DA59146C1A94549A00AED74C /* Guanaco.framework */,
|
||||
BEB31F341A0D6F7A00F525B9 /* Info.plist */,
|
||||
);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0610"
|
||||
LastUpgradeVersion = "0630"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@ -10,7 +10,7 @@ import Foundation
|
||||
|
||||
/// A git object.
|
||||
public protocol ObjectType {
|
||||
class var type: git_otype { get }
|
||||
static var type: git_otype { get }
|
||||
|
||||
/// The OID of the object.
|
||||
var oid: OID { get }
|
||||
|
||||
@ -55,7 +55,7 @@ final public class Repository {
|
||||
self.pointer = pointer
|
||||
|
||||
let path = git_repository_workdir(pointer)
|
||||
self.directoryURL = (path == nil ? nil : NSURL.fileURLWithPath(NSString(CString: path, encoding: NSUTF8StringEncoding)!, isDirectory: true))
|
||||
self.directoryURL = (path == nil ? nil : NSURL.fileURLWithPath(String.fromCString(path)!, isDirectory: true))
|
||||
}
|
||||
|
||||
deinit {
|
||||
@ -309,7 +309,7 @@ final public class Repository {
|
||||
public func localBranches() -> Result<[Branch], NSError> {
|
||||
return referencesWithPrefix("refs/heads/")
|
||||
.map { (refs: [ReferenceType]) in
|
||||
return refs.map { $0 as Branch }
|
||||
return refs.map { $0 as! Branch }
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,30 +317,30 @@ final public class Repository {
|
||||
public func remoteBranches() -> Result<[Branch], NSError> {
|
||||
return referencesWithPrefix("refs/remotes/")
|
||||
.map { (refs: [ReferenceType]) in
|
||||
return refs.map { $0 as Branch }
|
||||
return refs.map { $0 as! Branch }
|
||||
}
|
||||
}
|
||||
|
||||
/// Load the local branch with the given name (e.g., "master").
|
||||
public func localBranchWithName(name: String) -> Result<Branch, NSError> {
|
||||
return referenceWithName("refs/heads/" + name).map { $0 as Branch }
|
||||
return referenceWithName("refs/heads/" + name).map { $0 as! Branch }
|
||||
}
|
||||
|
||||
/// Load the remote branch with the given name (e.g., "origin/master").
|
||||
public func remoteBranchWithName(name: String) -> Result<Branch, NSError> {
|
||||
return referenceWithName("refs/remotes/" + name).map { $0 as Branch }
|
||||
return referenceWithName("refs/remotes/" + name).map { $0 as! Branch }
|
||||
}
|
||||
|
||||
/// Load and return a list of all the `TagReference`s.
|
||||
public func allTags() -> Result<[TagReference], NSError> {
|
||||
return referencesWithPrefix("refs/tags/")
|
||||
.map { (refs: [ReferenceType]) in
|
||||
return refs.map { $0 as TagReference }
|
||||
return refs.map { $0 as! TagReference }
|
||||
}
|
||||
}
|
||||
|
||||
/// Load the tag with the given name (e.g., "tag-2").
|
||||
public func tagWithName(name: String) -> Result<TagReference, NSError> {
|
||||
return referenceWithName("refs/tags/" + name).map { $0 as TagReference }
|
||||
return referenceWithName("refs/tags/" + name).map { $0 as! TagReference }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
framework module SwiftGit2 {
|
||||
umbrella header "SwiftGit2.h"
|
||||
|
||||
|
||||
header "git2/annotated_commit.h"
|
||||
header "git2/attr.h"
|
||||
header "git2/blob.h"
|
||||
@ -60,7 +60,7 @@ framework module SwiftGit2 {
|
||||
header "git2/tree.h"
|
||||
header "git2/types.h"
|
||||
header "git2/version.h"
|
||||
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ final class Fixtures {
|
||||
NSFileManager.defaultManager().createDirectoryAtURL(directoryURL, withIntermediateDirectories: true, attributes: nil, error: nil)
|
||||
|
||||
let bundle = NSBundle(identifier: "org.libgit2.SwiftGit2-OSXTests")!
|
||||
let zipURLs = bundle.URLsForResourcesWithExtension("zip", subdirectory: nil)! as [NSURL]
|
||||
let zipURLs = bundle.URLsForResourcesWithExtension("zip", subdirectory: nil)! as! [NSURL]
|
||||
|
||||
for URL in zipURLs {
|
||||
unzipFileAtURL(URL, intoDirectoryAtURL: directoryURL)
|
||||
|
||||
@ -144,7 +144,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!
|
||||
let blob = repo.blobWithOID(oid).value
|
||||
let result = repo.objectWithOID(oid)
|
||||
expect(result.map { $0 as Blob }).to(haveSucceeded(equal(blob)))
|
||||
expect(result.map { $0 as! Blob }).to(haveSucceeded(equal(blob)))
|
||||
}
|
||||
|
||||
it("should work with a commit") {
|
||||
@ -152,7 +152,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
let commit = repo.commitWithOID(oid).value
|
||||
let result = repo.objectWithOID(oid)
|
||||
expect(result.map { $0 as Commit }).to(haveSucceeded(equal(commit)))
|
||||
expect(result.map { $0 as! Commit }).to(haveSucceeded(equal(commit)))
|
||||
}
|
||||
|
||||
it("should work with a tag") {
|
||||
@ -160,7 +160,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")!
|
||||
let tag = repo.tagWithOID(oid).value
|
||||
let result = repo.objectWithOID(oid)
|
||||
expect(result.map { $0 as Tag }).to(haveSucceeded(equal(tag)))
|
||||
expect(result.map { $0 as! Tag }).to(haveSucceeded(equal(tag)))
|
||||
}
|
||||
|
||||
it("should work with a tree") {
|
||||
@ -168,7 +168,7 @@ class RepositorySpec: QuickSpec {
|
||||
let oid = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
|
||||
let tree = repo.treeWithOID(oid).value
|
||||
let result = repo.objectWithOID(oid)
|
||||
expect(result.map { $0 as Tree }).to(haveSucceeded(equal(tree)))
|
||||
expect(result.map { $0 as! Tree }).to(haveSucceeded(equal(tree)))
|
||||
}
|
||||
|
||||
it("should error if there's no object with that oid") {
|
||||
@ -224,7 +224,7 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
let pointer = Pointer.Commit(oid)
|
||||
let commit = repo.commitWithOID(oid).value!
|
||||
let result = repo.objectFromPointer(pointer).map { $0 as Commit }
|
||||
let result = repo.objectFromPointer(pointer).map { $0 as! Commit }
|
||||
expect(result).to(haveSucceeded(equal(commit)))
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
let pointer = Pointer.Tree(oid)
|
||||
let tree = repo.treeWithOID(oid).value!
|
||||
let result = repo.objectFromPointer(pointer).map { $0 as Tree }
|
||||
let result = repo.objectFromPointer(pointer).map { $0 as! Tree }
|
||||
expect(result).to(haveSucceeded(equal(tree)))
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
let pointer = Pointer.Blob(oid)
|
||||
let blob = repo.blobWithOID(oid).value!
|
||||
let result = repo.objectFromPointer(pointer).map { $0 as Blob }
|
||||
let result = repo.objectFromPointer(pointer).map { $0 as! Blob }
|
||||
expect(result).to(haveSucceeded(equal(blob)))
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ class RepositorySpec: QuickSpec {
|
||||
|
||||
let pointer = Pointer.Tag(oid)
|
||||
let tag = repo.tagWithOID(oid).value!
|
||||
let result = repo.objectFromPointer(pointer).map { $0 as Tag }
|
||||
let result = repo.objectFromPointer(pointer).map { $0 as! Tag }
|
||||
expect(result).to(haveSucceeded(equal(tag)))
|
||||
}
|
||||
}
|
||||
@ -294,21 +294,21 @@ class RepositorySpec: QuickSpec {
|
||||
let name = "refs/heads/master"
|
||||
let result = Fixtures.simpleRepository.referenceWithName(name)
|
||||
expect(result.map { $0.longName }).to(haveSucceeded(equal(name)))
|
||||
expect(result.value? as? Branch).notTo(beNil())
|
||||
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.referenceWithName(name)
|
||||
expect(result.map { $0.longName }).to(haveSucceeded(equal(name)))
|
||||
expect(result.value? as? Branch).notTo(beNil())
|
||||
expect(result.value as? Branch).notTo(beNil())
|
||||
}
|
||||
|
||||
it("should return a tag if it exists") {
|
||||
let name = "refs/tags/tag-2"
|
||||
let result = Fixtures.simpleRepository.referenceWithName(name)
|
||||
expect(result.value?.longName).to(equal(name))
|
||||
expect(result.value? as? TagReference).notTo(beNil())
|
||||
expect(result.value as? TagReference).notTo(beNil())
|
||||
}
|
||||
|
||||
it("should return the reference if it exists") {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user