mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
Merge pull request #47 from windmill-io/swift-2.0
SwiftGit2 won't build with Xcode 7.2 that uses Swift 2.0
This commit is contained in:
commit
d3f27174b4
2
Cartfile
2
Cartfile
@ -1 +1 @@
|
||||
github "antitypical/Result" ~> 0.4.1
|
||||
github "antitypical/Result" ~> 1.0.1
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
github "jspahrsummers/xcconfigs" >= 0.7.2
|
||||
github "Quick/Quick" "155f858bce082373fc60d0c0a63415bf336c676b"
|
||||
github "Quick/Nimble" ~> 0.4.1
|
||||
github "modocache/Guanaco" "26b6ceff4b8912abd0dfc3a9eed0a46527e040e3"
|
||||
github "Quick/Quick" "v0.8.0"
|
||||
github "Quick/Nimble" ~> 3.0.0
|
||||
github "modocache/Guanaco" "5031bf67297afbe61ac0f2fbf3e3e8400b3f8888"
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
github "robrix/Box" "1.2.2"
|
||||
github "modocache/Guanaco" "26b6ceff4b8912abd0dfc3a9eed0a46527e040e3"
|
||||
github "Quick/Nimble" "v0.4.2"
|
||||
github "Quick/Quick" "155f858bce082373fc60d0c0a63415bf336c676b"
|
||||
github "jspahrsummers/xcconfigs" "0.8"
|
||||
github "antitypical/Result" "0.4.1"
|
||||
github "modocache/Guanaco" "5031bf67297afbe61ac0f2fbf3e3e8400b3f8888"
|
||||
github "Quick/Nimble" "v3.0.0"
|
||||
github "Quick/Quick" "v0.8.0"
|
||||
github "antitypical/Result" "1.0.1"
|
||||
github "jspahrsummers/xcconfigs" "0.8.1"
|
||||
|
||||
1
Carthage/Checkouts/Box
vendored
1
Carthage/Checkouts/Box
vendored
@ -1 +0,0 @@
|
||||
Subproject commit bbe4e612a03ffe0bbb0e2e476c2be4534b6777a5
|
||||
2
Carthage/Checkouts/Guanaco
vendored
2
Carthage/Checkouts/Guanaco
vendored
@ -1 +1 @@
|
||||
Subproject commit 26b6ceff4b8912abd0dfc3a9eed0a46527e040e3
|
||||
Subproject commit 5031bf67297afbe61ac0f2fbf3e3e8400b3f8888
|
||||
2
Carthage/Checkouts/Nimble
vendored
2
Carthage/Checkouts/Nimble
vendored
@ -1 +1 @@
|
||||
Subproject commit 8927113f877f32c8a01b41b746c4ac261b42c48e
|
||||
Subproject commit 676d1c8aedd09253229474a5dca2fddbf3b445a1
|
||||
2
Carthage/Checkouts/Quick
vendored
2
Carthage/Checkouts/Quick
vendored
@ -1 +1 @@
|
||||
Subproject commit 155f858bce082373fc60d0c0a63415bf336c676b
|
||||
Subproject commit 46b38c9c06b068baede09586aa281a6f075b2494
|
||||
2
Carthage/Checkouts/Result
vendored
2
Carthage/Checkouts/Result
vendored
@ -1 +1 @@
|
||||
Subproject commit 7ae33c66eb7ed815d6066f2e9ecc372091423832
|
||||
Subproject commit 1a2c456268f4106f1b9b9e107920851f7fd2a8cd
|
||||
2
Carthage/Checkouts/xcconfigs
vendored
2
Carthage/Checkouts/xcconfigs
vendored
@ -1 +1 @@
|
||||
Subproject commit 813127f87f66fa14a7da03d3fa8410c02d2075d6
|
||||
Subproject commit d78854b22b9567e7f30d748bdd4966c86bcc93a5
|
||||
@ -634,7 +634,8 @@
|
||||
BEB31F1A1A0D6F7A00F525B9 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0630;
|
||||
LastSwiftUpdateCheck = 0720;
|
||||
LastUpgradeCheck = 0720;
|
||||
ORGANIZATIONNAME = "GitHub, Inc";
|
||||
TargetAttributes = {
|
||||
BEB31F221A0D6F7A00F525B9 = {
|
||||
@ -765,6 +766,7 @@
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
@ -868,6 +870,7 @@
|
||||
"-lcrypto",
|
||||
"-lssl",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = SwiftGit2;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@ -897,6 +900,7 @@
|
||||
"-lcrypto",
|
||||
"-lssl",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = SwiftGit2;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
@ -917,6 +921,7 @@
|
||||
);
|
||||
INFOPLIST_FILE = SwiftGit2Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
@ -932,6 +937,7 @@
|
||||
);
|
||||
INFOPLIST_FILE = SwiftGit2Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0630"
|
||||
LastUpgradeVersion = "0720"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -23,10 +23,10 @@
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
@ -39,15 +39,18 @@
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
@ -62,10 +65,10 @@
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
||||
3
SwiftGit2.xcworkspace/contents.xcworkspacedata
generated
3
SwiftGit2.xcworkspace/contents.xcworkspacedata
generated
@ -4,9 +4,6 @@
|
||||
<FileRef
|
||||
location = "group:SwiftGit2.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Carthage/Checkouts/Box/Box.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Carthage/Checkouts/Result/Result.xcodeproj">
|
||||
</FileRef>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
/// The flags defining how a checkout should be performed.
|
||||
/// More detail is available in the libgit2 documentation for `git_checkout_strategy_t`.
|
||||
public struct CheckoutStrategy : RawOptionSetType {
|
||||
public struct CheckoutStrategy : OptionSetType {
|
||||
private let value: UInt
|
||||
|
||||
// MARK: - Initialization
|
||||
@ -23,11 +23,11 @@ public struct CheckoutStrategy : RawOptionSetType {
|
||||
}
|
||||
|
||||
public init(_ strategy: git_checkout_strategy_t) {
|
||||
self.value = UInt(strategy.value)
|
||||
self.value = UInt(strategy.rawValue)
|
||||
}
|
||||
|
||||
public static var allZeros: CheckoutStrategy {
|
||||
return self(rawValue: 0)
|
||||
return self.init(rawValue: 0)
|
||||
}
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
@ -40,7 +40,7 @@ private func errorMessage(errorCode: Int32) -> String? {
|
||||
let last = giterr_last()
|
||||
if last != nil {
|
||||
return String.fromCString(last.memory.message)
|
||||
} else if UInt32(errorCode) == GITERR_OS.value {
|
||||
} else if UInt32(errorCode) == GITERR_OS.rawValue {
|
||||
return String.fromCString(strerror(errno))
|
||||
} else {
|
||||
return nil
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.libgit2.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
func == (lhs: git_otype, rhs: git_otype) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
return lhs.rawValue == rhs.rawValue
|
||||
}
|
||||
|
||||
extension git_strarray {
|
||||
@ -16,7 +16,7 @@ extension git_strarray {
|
||||
}
|
||||
|
||||
func map<T>(f: (String) -> T) -> [T] {
|
||||
return Swift.map(0..<self.count) {
|
||||
return (0..<self.count).map {
|
||||
let string = String.fromCString(self.strings[Int($0)])!
|
||||
return f(string)
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ public struct OID {
|
||||
let pointer = UnsafeMutablePointer<git_oid>.alloc(1)
|
||||
let result = git_oid_fromstr(pointer, string)
|
||||
|
||||
if result < GIT_OK.value {
|
||||
if result < GIT_OK.rawValue {
|
||||
pointer.dealloc(1)
|
||||
return nil;
|
||||
}
|
||||
@ -45,7 +45,7 @@ public struct OID {
|
||||
public let oid: git_oid
|
||||
}
|
||||
|
||||
extension OID: Printable {
|
||||
extension OID: CustomStringConvertible {
|
||||
public var description: String {
|
||||
let length = Int(GIT_OID_RAWSZ) * 2
|
||||
let string = UnsafeMutablePointer<Int8>.alloc(length)
|
||||
@ -68,9 +68,9 @@ extension OID: Hashable {
|
||||
self.oid.id.6,
|
||||
self.oid.id.7
|
||||
]
|
||||
return reduce(bytes, 0, { (hash, byte) in
|
||||
return bytes.reduce(0) { (hash, byte) in
|
||||
return Int(hash << 8) | Int(byte)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ public struct Commit: ObjectType {
|
||||
committer = Signature(git_commit_committer(pointer).memory)
|
||||
tree = PointerTo(OID(git_commit_tree_id(pointer).memory))
|
||||
|
||||
self.parents = map(0..<git_commit_parentcount(pointer)) {
|
||||
self.parents = (0..<git_commit_parentcount(pointer)).map {
|
||||
return PointerTo(OID(git_commit_parent_id(pointer, $0).memory))
|
||||
}
|
||||
}
|
||||
@ -118,7 +118,7 @@ public struct Tree: ObjectType {
|
||||
/// Create an instance with a libgit2 `git_tree_entry`.
|
||||
public init(_ pointer: COpaquePointer) {
|
||||
let oid = OID(git_tree_entry_id(pointer).memory)
|
||||
attributes = Int32(git_tree_entry_filemode(pointer).value)
|
||||
attributes = Int32(git_tree_entry_filemode(pointer).rawValue)
|
||||
object = Pointer(oid: oid, type: git_tree_entry_type(pointer))!
|
||||
name = String.fromCString(git_tree_entry_name(pointer))!
|
||||
}
|
||||
@ -156,7 +156,7 @@ extension Tree.Entry: Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
extension Tree.Entry: Printable {
|
||||
extension Tree.Entry: CustomStringConvertible {
|
||||
public var description: String {
|
||||
return "\(attributes) \(object) \(name)"
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ public protocol PointerType: Equatable, Hashable {
|
||||
}
|
||||
|
||||
public func == <P: PointerType>(lhs: P, rhs: P) -> Bool {
|
||||
return lhs.oid == rhs.oid && lhs.type.value == rhs.type.value
|
||||
return lhs.oid == rhs.oid && lhs.type.rawValue == rhs.type.rawValue
|
||||
}
|
||||
|
||||
/// A pointer to a git object.
|
||||
@ -45,27 +45,27 @@ public enum Pointer: PointerType {
|
||||
|
||||
public var type: git_otype {
|
||||
switch self {
|
||||
case let Commit(oid):
|
||||
case Commit:
|
||||
return GIT_OBJ_COMMIT
|
||||
case let Tree(oid):
|
||||
case Tree:
|
||||
return GIT_OBJ_TREE
|
||||
case let Blob(oid):
|
||||
case Blob:
|
||||
return GIT_OBJ_BLOB
|
||||
case let Tag(oid):
|
||||
case Tag:
|
||||
return GIT_OBJ_TAG
|
||||
}
|
||||
}
|
||||
|
||||
/// Create an instance with an OID and a libgit2 `git_otype`.
|
||||
init?(oid: OID, type: git_otype) {
|
||||
switch type.value {
|
||||
case GIT_OBJ_COMMIT.value:
|
||||
switch type {
|
||||
case GIT_OBJ_COMMIT:
|
||||
self = Commit(oid)
|
||||
case GIT_OBJ_TREE.value:
|
||||
case GIT_OBJ_TREE:
|
||||
self = Tree(oid)
|
||||
case GIT_OBJ_BLOB.value:
|
||||
case GIT_OBJ_BLOB:
|
||||
self = Blob(oid)
|
||||
case GIT_OBJ_TAG.value:
|
||||
case GIT_OBJ_TAG:
|
||||
self = Tag(oid)
|
||||
default:
|
||||
return nil
|
||||
@ -79,7 +79,7 @@ extension Pointer: Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
extension Pointer: Printable {
|
||||
extension Pointer: CustomStringConvertible {
|
||||
public var description: String {
|
||||
switch self {
|
||||
case Commit:
|
||||
|
||||
@ -96,7 +96,7 @@ public struct Branch: ReferenceType {
|
||||
public init?(_ pointer: COpaquePointer) {
|
||||
let namePointer = UnsafeMutablePointer<UnsafePointer<Int8>>.alloc(1)
|
||||
let success = git_branch_name(namePointer, pointer)
|
||||
if success != GIT_OK.value {
|
||||
if success != GIT_OK.rawValue {
|
||||
namePointer.dealloc(1)
|
||||
return nil
|
||||
}
|
||||
@ -106,10 +106,10 @@ public struct Branch: ReferenceType {
|
||||
longName = String.fromCString(git_reference_name(pointer))!
|
||||
|
||||
var oid: OID
|
||||
if git_reference_type(pointer).value == GIT_REF_SYMBOLIC.value {
|
||||
if git_reference_type(pointer).rawValue == GIT_REF_SYMBOLIC.rawValue {
|
||||
var resolved: COpaquePointer = nil
|
||||
let success = git_reference_resolve(&resolved, pointer)
|
||||
if success != GIT_OK.value {
|
||||
if success != GIT_OK.rawValue {
|
||||
return nil
|
||||
}
|
||||
oid = OID(git_reference_target(resolved).memory)
|
||||
@ -184,7 +184,7 @@ public enum TagReference: ReferenceType {
|
||||
|
||||
var pointer: COpaquePointer = nil
|
||||
let result = git_object_lookup(&pointer, repo, &oid, GIT_OBJ_TAG)
|
||||
if result == GIT_OK.value {
|
||||
if result == GIT_OK.rawValue {
|
||||
self = .Annotated(name, Tag(pointer))
|
||||
} else {
|
||||
self = .Lightweight(name, OID(oid))
|
||||
|
||||
@ -25,12 +25,12 @@ final public class Repository {
|
||||
var pointer: COpaquePointer = nil
|
||||
let result = git_repository_open(&pointer, URL.fileSystemRepresentation)
|
||||
|
||||
if result != GIT_OK.value {
|
||||
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_open"))
|
||||
if result != GIT_OK.rawValue {
|
||||
return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_open"))
|
||||
}
|
||||
|
||||
let repository = Repository(pointer)
|
||||
return Result.success(repository)
|
||||
return Result.Success(repository)
|
||||
}
|
||||
|
||||
// MARK: - Initializers
|
||||
@ -74,8 +74,8 @@ final public class Repository {
|
||||
var oid = oid.oid
|
||||
let result = git_object_lookup(&pointer, self.pointer, &oid, type)
|
||||
|
||||
if result != GIT_OK.value {
|
||||
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_object_lookup"))
|
||||
if result != GIT_OK.rawValue {
|
||||
return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_object_lookup"))
|
||||
}
|
||||
|
||||
let value = transform(pointer)
|
||||
@ -84,7 +84,7 @@ final public class Repository {
|
||||
}
|
||||
|
||||
func withLibgit2Object<T>(oid: OID, type: git_otype, transform: COpaquePointer -> T) -> Result<T, NSError> {
|
||||
return withLibgit2Object(oid, type: type) { Result.success(transform($0)) }
|
||||
return withLibgit2Object(oid, type: type) { Result.Success(transform($0)) }
|
||||
}
|
||||
|
||||
/// Loads the object with the given OID.
|
||||
@ -96,15 +96,15 @@ final public class Repository {
|
||||
return withLibgit2Object(oid, type: GIT_OBJ_ANY) { object in
|
||||
let type = git_object_type(object)
|
||||
if type == Blob.type {
|
||||
return Result.success(Blob(object))
|
||||
return Result.Success(Blob(object))
|
||||
} else if type == Commit.type {
|
||||
return Result.success(Commit(object))
|
||||
return Result.Success(Commit(object))
|
||||
} else if type == Tag.type {
|
||||
return Result.success(Tag(object))
|
||||
return Result.Success(Tag(object))
|
||||
} else if type == Tree.type {
|
||||
return Result.success(Tree(object))
|
||||
return Result.Success(Tree(object))
|
||||
}
|
||||
|
||||
|
||||
let error = NSError(
|
||||
domain: "org.libgit2.SwiftGit2",
|
||||
code: 1,
|
||||
@ -112,7 +112,7 @@ final public class Repository {
|
||||
NSLocalizedDescriptionKey: "Unrecognized git_otype '\(type)' for oid '\(oid)'."
|
||||
]
|
||||
)
|
||||
return Result.failure(error)
|
||||
return Result.Failure(error)
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ final public class Repository {
|
||||
public func blobWithOID(oid: OID) -> Result<Blob, NSError> {
|
||||
return self.withLibgit2Object(oid, type: GIT_OBJ_BLOB) { Blob($0) }
|
||||
}
|
||||
|
||||
|
||||
/// Loads the commit with the given OID.
|
||||
///
|
||||
/// oid - The OID of the commit to look up.
|
||||
@ -188,9 +188,9 @@ final public class Repository {
|
||||
let pointer = UnsafeMutablePointer<git_strarray>.alloc(1)
|
||||
let result = git_remote_list(pointer, self.pointer)
|
||||
|
||||
if result != GIT_OK.value {
|
||||
if result != GIT_OK.rawValue {
|
||||
pointer.dealloc(1)
|
||||
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_list"))
|
||||
return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_list"))
|
||||
}
|
||||
|
||||
let strarray = pointer.memory
|
||||
@ -202,9 +202,9 @@ final public class Repository {
|
||||
|
||||
let error = remotes.reduce(nil) { $0 == nil ? $0 : $1.error }
|
||||
if let error = error {
|
||||
return Result.failure(error)
|
||||
return Result.Failure(error)
|
||||
}
|
||||
return Result.success(remotes.map { $0.value! })
|
||||
return Result.Success(remotes.map { $0.value! })
|
||||
}
|
||||
|
||||
/// Load a remote from the repository.
|
||||
@ -216,13 +216,13 @@ final public class Repository {
|
||||
var pointer: COpaquePointer = nil
|
||||
let result = git_remote_lookup(&pointer, self.pointer, name)
|
||||
|
||||
if result != GIT_OK.value {
|
||||
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_lookup"))
|
||||
if result != GIT_OK.rawValue {
|
||||
return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_lookup"))
|
||||
}
|
||||
|
||||
let value = Remote(pointer)
|
||||
git_remote_free(pointer)
|
||||
return Result.success(value)
|
||||
return Result.Success(value)
|
||||
}
|
||||
|
||||
// MARK: - Reference Lookups
|
||||
@ -232,9 +232,9 @@ final public class Repository {
|
||||
let pointer = UnsafeMutablePointer<git_strarray>.alloc(1)
|
||||
let result = git_reference_list(pointer, self.pointer)
|
||||
|
||||
if result != GIT_OK.value {
|
||||
if result != GIT_OK.rawValue {
|
||||
pointer.dealloc(1)
|
||||
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_list"))
|
||||
return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_list"))
|
||||
}
|
||||
|
||||
let strarray = pointer.memory
|
||||
@ -250,9 +250,9 @@ final public class Repository {
|
||||
|
||||
let error = references.reduce(nil) { $0 == nil ? $0 : $1.error }
|
||||
if let error = error {
|
||||
return Result.failure(error)
|
||||
return Result.Failure(error)
|
||||
}
|
||||
return Result.success(references.map { $0.value! })
|
||||
return Result.Success(references.map { $0.value! })
|
||||
}
|
||||
|
||||
/// Load the reference with the given long name (e.g. "refs/heads/master")
|
||||
@ -264,13 +264,13 @@ final public class Repository {
|
||||
var pointer: COpaquePointer = nil
|
||||
let result = git_reference_lookup(&pointer, self.pointer, name)
|
||||
|
||||
if result != GIT_OK.value {
|
||||
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_lookup"))
|
||||
if result != GIT_OK.rawValue {
|
||||
return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_lookup"))
|
||||
}
|
||||
|
||||
let value = referenceWithLibGit2Reference(pointer)
|
||||
git_reference_free(pointer)
|
||||
return Result.success(value)
|
||||
return Result.Success(value)
|
||||
}
|
||||
|
||||
/// Load and return a list of all local branches.
|
||||
@ -320,12 +320,12 @@ final public class Repository {
|
||||
public func HEAD() -> Result<ReferenceType, NSError> {
|
||||
var pointer: COpaquePointer = nil
|
||||
let result = git_repository_head(&pointer, self.pointer)
|
||||
if result != GIT_OK.value {
|
||||
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_head"))
|
||||
if result != GIT_OK.rawValue {
|
||||
return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_head"))
|
||||
}
|
||||
let value = referenceWithLibGit2Reference(pointer)
|
||||
git_reference_free(pointer)
|
||||
return Result.success(value)
|
||||
return Result.Success(value)
|
||||
}
|
||||
|
||||
/// Set HEAD to the given oid (detached).
|
||||
@ -335,10 +335,10 @@ final public class Repository {
|
||||
public func setHEAD(oid: OID) -> Result<(), NSError> {
|
||||
var oid = oid.oid
|
||||
let result = git_repository_set_head_detached(self.pointer, &oid);
|
||||
if result != GIT_OK.value {
|
||||
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
|
||||
if result != GIT_OK.rawValue {
|
||||
return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
|
||||
}
|
||||
return Result.success()
|
||||
return Result.Success()
|
||||
}
|
||||
|
||||
/// Set HEAD to the given reference.
|
||||
@ -347,10 +347,10 @@ final public class Repository {
|
||||
/// :returns: Returns a result with void or the error that occurred.
|
||||
public func setHEAD(reference: ReferenceType) -> Result<(), NSError> {
|
||||
let result = git_repository_set_head(self.pointer, reference.longName);
|
||||
if result != GIT_OK.value {
|
||||
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
|
||||
if result != GIT_OK.rawValue {
|
||||
return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
|
||||
}
|
||||
return Result.success()
|
||||
return Result.Success()
|
||||
}
|
||||
|
||||
/// Check out HEAD.
|
||||
@ -358,16 +358,16 @@ final public class Repository {
|
||||
/// :param: strategy The checkout strategy to use.
|
||||
/// :param: progress A block that's called with the progress of the checkout.
|
||||
/// :returns: Returns a result with void or the error that occurred.
|
||||
public func checkout(#strategy: CheckoutStrategy, progress: CheckoutProgressBlock? = nil) -> Result<(), NSError> {
|
||||
public func checkout(strategy strategy: CheckoutStrategy, progress: CheckoutProgressBlock? = nil) -> Result<(), NSError> {
|
||||
var options = SG2CheckoutOptions(progress)
|
||||
options.checkout_strategy = strategy.git_checkout_strategy.value
|
||||
options.checkout_strategy = strategy.git_checkout_strategy.rawValue
|
||||
|
||||
let result = git_checkout_head(self.pointer, &options)
|
||||
if result != GIT_OK.value {
|
||||
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_checkout_head"))
|
||||
if result != GIT_OK.rawValue {
|
||||
return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_checkout_head"))
|
||||
}
|
||||
|
||||
return Result.success()
|
||||
return Result.Success()
|
||||
}
|
||||
|
||||
/// Check out the given OID.
|
||||
|
||||
@ -21,10 +21,9 @@ final class Fixtures {
|
||||
}
|
||||
|
||||
init() {
|
||||
let path = NSTemporaryDirectory()
|
||||
.stringByAppendingPathComponent("org.libgit2.SwiftGit2")
|
||||
.stringByAppendingPathComponent(NSProcessInfo.processInfo().globallyUniqueString)
|
||||
directoryURL = NSURL.fileURLWithPath(path, isDirectory: true)!
|
||||
directoryURL = NSURL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
|
||||
.URLByAppendingPathComponent("org.libgit2.SwiftGit2")
|
||||
.URLByAppendingPathComponent(NSProcessInfo.processInfo().globallyUniqueString)
|
||||
}
|
||||
|
||||
// MARK: - Setup and Teardown
|
||||
@ -32,10 +31,10 @@ final class Fixtures {
|
||||
let directoryURL: NSURL
|
||||
|
||||
func setUp() {
|
||||
NSFileManager.defaultManager().createDirectoryAtURL(directoryURL, withIntermediateDirectories: true, attributes: nil, error: nil)
|
||||
try! NSFileManager.defaultManager().createDirectoryAtURL(directoryURL, withIntermediateDirectories: true, attributes: 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)
|
||||
@ -43,7 +42,7 @@ final class Fixtures {
|
||||
}
|
||||
|
||||
func tearDown() {
|
||||
NSFileManager.defaultManager().removeItemAtURL(directoryURL, error: nil)
|
||||
try! NSFileManager.defaultManager().removeItemAtURL(directoryURL)
|
||||
}
|
||||
|
||||
func unzipFileAtURL(fileURL: NSURL, intoDirectoryAtURL directoryURL: NSURL) {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.libgit2.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
||||
@ -30,7 +30,7 @@ class SignatureSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
|
||||
let raw_signature = from_git_object(repo, oid) { git_commit_author($0).memory }
|
||||
let raw_signature = from_git_object(repo, oid: oid) { git_commit_author($0).memory }
|
||||
let signature = Signature(raw_signature)
|
||||
|
||||
expect(signature.name).to(equal("Matt Diephouse"))
|
||||
@ -45,7 +45,7 @@ class SignatureSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
|
||||
let author1 = from_git_object(repo, oid) { commit in
|
||||
let author1 = from_git_object(repo, oid: oid) { commit in
|
||||
Signature(git_commit_author(commit).memory)
|
||||
}
|
||||
let author2 = author1
|
||||
@ -58,10 +58,10 @@ class SignatureSpec: QuickSpec {
|
||||
let oid1 = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
let oid2 = OID(string: "24e1e40ee77525d9e279f079f9906ad6d98c8940")!
|
||||
|
||||
let author1 = from_git_object(repo, oid1) { commit in
|
||||
let author1 = from_git_object(repo, oid: oid1) { commit in
|
||||
Signature(git_commit_author(commit).memory)
|
||||
}
|
||||
let author2 = from_git_object(repo, oid2) { commit in
|
||||
let author2 = from_git_object(repo, oid: oid2) { commit in
|
||||
Signature(git_commit_author(commit).memory)
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ class SignatureSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
|
||||
let author1 = from_git_object(repo, oid) { commit in
|
||||
let author1 = from_git_object(repo, oid: oid) { commit in
|
||||
Signature(git_commit_author(commit).memory)
|
||||
}
|
||||
let author2 = author1
|
||||
@ -92,11 +92,11 @@ class CommitSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "24e1e40ee77525d9e279f079f9906ad6d98c8940")!
|
||||
|
||||
let commit = from_git_object(repo, oid) { Commit($0) }
|
||||
let author = from_git_object(repo, oid) { commit in
|
||||
let commit = from_git_object(repo, oid: oid) { Commit($0) }
|
||||
let author = from_git_object(repo, oid: oid) { commit in
|
||||
Signature(git_commit_author(commit).memory)
|
||||
}
|
||||
let committer = from_git_object(repo, oid) { commit in
|
||||
let committer = from_git_object(repo, oid: oid) { commit in
|
||||
Signature(git_commit_committer(commit).memory)
|
||||
}
|
||||
let tree = PointerTo<Tree>(OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!)
|
||||
@ -115,7 +115,7 @@ class CommitSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
|
||||
let commit = from_git_object(repo, oid) { Commit($0) }
|
||||
let commit = from_git_object(repo, oid: oid) { Commit($0) }
|
||||
expect(commit.parents).to(equal([]))
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ class CommitSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "c4ed03a6b7d7ce837d31d83757febbe84dd465fd")!
|
||||
|
||||
let commit = from_git_object(repo, oid) { Commit($0) }
|
||||
let commit = from_git_object(repo, oid: oid) { Commit($0) }
|
||||
let parents: [PointerTo<Commit>] = [
|
||||
PointerTo(OID(string: "315b3f344221db91ddc54b269f3c9af422da0f2e")!),
|
||||
PointerTo(OID(string: "57f6197561d1f99b03c160f4026a07f06b43cf20")!),
|
||||
@ -137,7 +137,7 @@ class CommitSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
|
||||
let commit1 = from_git_object(repo, oid) { Commit($0) }
|
||||
let commit1 = from_git_object(repo, oid: oid) { Commit($0) }
|
||||
let commit2 = commit1
|
||||
expect(commit1).to(equal(commit2))
|
||||
}
|
||||
@ -147,8 +147,8 @@ class CommitSpec: QuickSpec {
|
||||
let oid1 = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
let oid2 = OID(string: "c4ed03a6b7d7ce837d31d83757febbe84dd465fd")!
|
||||
|
||||
let commit1 = from_git_object(repo, oid1) { Commit($0) }
|
||||
let commit2 = from_git_object(repo, oid2) { Commit($0) }
|
||||
let commit1 = from_git_object(repo, oid: oid1) { Commit($0) }
|
||||
let commit2 = from_git_object(repo, oid: oid2) { Commit($0) }
|
||||
expect(commit1).notTo(equal(commit2))
|
||||
}
|
||||
}
|
||||
@ -158,7 +158,7 @@ class CommitSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
|
||||
|
||||
let commit1 = from_git_object(repo, oid) { Commit($0) }
|
||||
let commit1 = from_git_object(repo, oid: oid) { Commit($0) }
|
||||
let commit2 = commit1
|
||||
expect(commit1.hashValue).to(equal(commit2.hashValue))
|
||||
}
|
||||
@ -170,7 +170,7 @@ class TreeEntrySpec: QuickSpec {
|
||||
override func spec() {
|
||||
describe("Tree.Entry(attributes:object:name:)") {
|
||||
it("should set its properties") {
|
||||
let attributes = Int32(GIT_FILEMODE_BLOB.value)
|
||||
let attributes = Int32(GIT_FILEMODE_BLOB.rawValue)
|
||||
let object = Pointer.Blob(OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!)
|
||||
let name = "README.md"
|
||||
|
||||
@ -186,8 +186,8 @@ class TreeEntrySpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
|
||||
|
||||
let entry = from_git_object(repo, oid) { Tree.Entry(git_tree_entry_byindex($0, 0)) }
|
||||
expect(entry.attributes).to(equal(Int32(GIT_FILEMODE_BLOB.value)))
|
||||
let entry = from_git_object(repo, oid: oid) { Tree.Entry(git_tree_entry_byindex($0, 0)) }
|
||||
expect(entry.attributes).to(equal(Int32(GIT_FILEMODE_BLOB.rawValue)))
|
||||
expect(entry.object).to(equal(Pointer.Blob(OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!)))
|
||||
expect(entry.name).to(equal("README.md"))
|
||||
}
|
||||
@ -198,7 +198,7 @@ class TreeEntrySpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
|
||||
|
||||
let entry1 = from_git_object(repo, oid) { Tree.Entry(git_tree_entry_byindex($0, 0)) }
|
||||
let entry1 = from_git_object(repo, oid: oid) { Tree.Entry(git_tree_entry_byindex($0, 0)) }
|
||||
let entry2 = entry1
|
||||
expect(entry1).to(equal(entry2))
|
||||
}
|
||||
@ -208,8 +208,8 @@ class TreeEntrySpec: QuickSpec {
|
||||
let oid1 = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
|
||||
let oid2 = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
|
||||
|
||||
let entry1 = from_git_object(repo, oid1) { Tree.Entry(git_tree_entry_byindex($0, 0)) }
|
||||
let entry2 = from_git_object(repo, oid2) { Tree.Entry(git_tree_entry_byindex($0, 0)) }
|
||||
let entry1 = from_git_object(repo, oid: oid1) { Tree.Entry(git_tree_entry_byindex($0, 0)) }
|
||||
let entry2 = from_git_object(repo, oid: oid2) { Tree.Entry(git_tree_entry_byindex($0, 0)) }
|
||||
expect(entry1).notTo(equal(entry2))
|
||||
}
|
||||
}
|
||||
@ -219,7 +219,7 @@ class TreeEntrySpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
|
||||
|
||||
let entry1 = from_git_object(repo, oid) { Tree.Entry(git_tree_entry_byindex($0, 0)) }
|
||||
let entry1 = from_git_object(repo, oid: oid) { Tree.Entry(git_tree_entry_byindex($0, 0)) }
|
||||
let entry2 = entry1
|
||||
expect(entry1.hashValue).to(equal(entry2.hashValue))
|
||||
}
|
||||
@ -234,9 +234,9 @@ class TreeSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
|
||||
|
||||
let tree = from_git_object(repo, oid) { Tree($0) }
|
||||
let tree = from_git_object(repo, oid: oid) { Tree($0) }
|
||||
let entries = [
|
||||
"README.md": Tree.Entry(attributes: Int32(GIT_FILEMODE_BLOB.value), object: .Blob(OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!), name: "README.md"),
|
||||
"README.md": Tree.Entry(attributes: Int32(GIT_FILEMODE_BLOB.rawValue), object: .Blob(OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!), name: "README.md"),
|
||||
]
|
||||
expect(tree.entries).to(equal(entries))
|
||||
}
|
||||
@ -247,7 +247,7 @@ class TreeSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
|
||||
|
||||
let tree1 = from_git_object(repo, oid) { Tree($0) }
|
||||
let tree1 = from_git_object(repo, oid: oid) { Tree($0) }
|
||||
let tree2 = tree1
|
||||
expect(tree1).to(equal(tree2))
|
||||
}
|
||||
@ -257,8 +257,8 @@ class TreeSpec: QuickSpec {
|
||||
let oid1 = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
|
||||
let oid2 = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
|
||||
|
||||
let tree1 = from_git_object(repo, oid1) { Tree($0) }
|
||||
let tree2 = from_git_object(repo, oid2) { Tree($0) }
|
||||
let tree1 = from_git_object(repo, oid: oid1) { Tree($0) }
|
||||
let tree2 = from_git_object(repo, oid: oid2) { Tree($0) }
|
||||
expect(tree1).notTo(equal(tree2))
|
||||
}
|
||||
}
|
||||
@ -268,7 +268,7 @@ class TreeSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
|
||||
|
||||
let tree1 = from_git_object(repo, oid) { Tree($0) }
|
||||
let tree1 = from_git_object(repo, oid: oid) { Tree($0) }
|
||||
let tree2 = tree1
|
||||
expect(tree1.hashValue).to(equal(tree2.hashValue))
|
||||
}
|
||||
@ -283,7 +283,7 @@ class BlobSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!
|
||||
|
||||
let blob = from_git_object(repo, oid) { Blob($0) }
|
||||
let blob = from_git_object(repo, oid: oid) { Blob($0) }
|
||||
let contents = "# Simple Repository\nA simple repository used for testing SwiftGit2.\n\n## Branches\n\n- master\n\n"
|
||||
let data = (contents as NSString).dataUsingEncoding(NSUTF8StringEncoding)!
|
||||
expect(blob.oid).to(equal(oid))
|
||||
@ -296,7 +296,7 @@ class BlobSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!
|
||||
|
||||
let blob1 = from_git_object(repo, oid) { Blob($0) }
|
||||
let blob1 = from_git_object(repo, oid: oid) { Blob($0) }
|
||||
let blob2 = blob1
|
||||
expect(blob1).to(equal(blob2))
|
||||
}
|
||||
@ -306,8 +306,8 @@ class BlobSpec: QuickSpec {
|
||||
let oid1 = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!
|
||||
let oid2 = OID(string: "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391")!
|
||||
|
||||
let blob1 = from_git_object(repo, oid1) { Blob($0) }
|
||||
let blob2 = from_git_object(repo, oid2) { Blob($0) }
|
||||
let blob1 = from_git_object(repo, oid: oid1) { Blob($0) }
|
||||
let blob2 = from_git_object(repo, oid: oid2) { Blob($0) }
|
||||
expect(blob1).notTo(equal(blob2))
|
||||
}
|
||||
}
|
||||
@ -317,7 +317,7 @@ class BlobSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!
|
||||
|
||||
let blob1 = from_git_object(repo, oid) { Blob($0) }
|
||||
let blob1 = from_git_object(repo, oid: oid) { Blob($0) }
|
||||
let blob2 = blob1
|
||||
expect(blob1.hashValue).to(equal(blob2.hashValue))
|
||||
}
|
||||
@ -332,8 +332,8 @@ class TagSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")!
|
||||
|
||||
let tag = from_git_object(repo, oid) { Tag($0) }
|
||||
let tagger = from_git_object(repo, oid) { Signature(git_tag_tagger($0).memory) }
|
||||
let tag = from_git_object(repo, oid: oid) { Tag($0) }
|
||||
let tagger = from_git_object(repo, oid: oid) { Signature(git_tag_tagger($0).memory) }
|
||||
|
||||
expect(tag.oid).to(equal(oid))
|
||||
expect(tag.target).to(equal(Pointer.Commit(OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!)))
|
||||
@ -348,7 +348,7 @@ class TagSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")!
|
||||
|
||||
let tag1 = from_git_object(repo, oid) { Tag($0) }
|
||||
let tag1 = from_git_object(repo, oid: oid) { Tag($0) }
|
||||
let tag2 = tag1
|
||||
expect(tag1).to(equal(tag2))
|
||||
}
|
||||
@ -358,8 +358,8 @@ class TagSpec: QuickSpec {
|
||||
let oid1 = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")!
|
||||
let oid2 = OID(string: "13bda91157f255ab224ff88d0a11a82041c9d0c1")!
|
||||
|
||||
let tag1 = from_git_object(repo, oid1) { Tag($0) }
|
||||
let tag2 = from_git_object(repo, oid2) { Tag($0) }
|
||||
let tag1 = from_git_object(repo, oid: oid1) { Tag($0) }
|
||||
let tag2 = from_git_object(repo, oid: oid2) { Tag($0) }
|
||||
expect(tag1).notTo(equal(tag2))
|
||||
}
|
||||
}
|
||||
@ -369,7 +369,7 @@ class TagSpec: QuickSpec {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")!
|
||||
|
||||
let tag1 = from_git_object(repo, oid) { Tag($0) }
|
||||
let tag1 = from_git_object(repo, oid: oid) { Tag($0) }
|
||||
let tag2 = tag1
|
||||
expect(tag1.hashValue).to(equal(tag2.hashValue))
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ class ReferenceSpec: QuickSpec {
|
||||
describe("Reference(pointer)") {
|
||||
it("should initialize its properties") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let ref = from_git_reference(repo, "refs/heads/master") { Reference($0) }
|
||||
let ref = from_git_reference(repo, name: "refs/heads/master") { Reference($0) }
|
||||
expect(ref.longName).to(equal("refs/heads/master"))
|
||||
expect(ref.shortName).to(equal("master"))
|
||||
expect(ref.oid).to(equal(OID(string: "c4ed03a6b7d7ce837d31d83757febbe84dd465fd")!))
|
||||
@ -37,15 +37,15 @@ class ReferenceSpec: QuickSpec {
|
||||
describe("==(Reference, Reference)") {
|
||||
it("should be true with equal references") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let ref1 = from_git_reference(repo, "refs/heads/master") { Reference($0) }
|
||||
let ref2 = from_git_reference(repo, "refs/heads/master") { Reference($0) }
|
||||
let ref1 = from_git_reference(repo, name: "refs/heads/master") { Reference($0) }
|
||||
let ref2 = from_git_reference(repo, name: "refs/heads/master") { Reference($0) }
|
||||
expect(ref1).to(equal(ref2))
|
||||
}
|
||||
|
||||
it("should be false with unequal references") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let ref1 = from_git_reference(repo, "refs/heads/master") { Reference($0) }
|
||||
let ref2 = from_git_reference(repo, "refs/heads/another-branch") { Reference($0) }
|
||||
let ref1 = from_git_reference(repo, name: "refs/heads/master") { Reference($0) }
|
||||
let ref2 = from_git_reference(repo, name: "refs/heads/another-branch") { Reference($0) }
|
||||
expect(ref1).notTo(equal(ref2))
|
||||
}
|
||||
}
|
||||
@ -53,8 +53,8 @@ class ReferenceSpec: QuickSpec {
|
||||
describe("Reference.hashValue") {
|
||||
it("should be equal with equal references") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let ref1 = from_git_reference(repo, "refs/heads/master") { Reference($0) }
|
||||
let ref2 = from_git_reference(repo, "refs/heads/master") { Reference($0) }
|
||||
let ref1 = from_git_reference(repo, name: "refs/heads/master") { Reference($0) }
|
||||
let ref2 = from_git_reference(repo, name: "refs/heads/master") { Reference($0) }
|
||||
expect(ref1.hashValue).to(equal(ref2.hashValue))
|
||||
}
|
||||
}
|
||||
@ -66,7 +66,7 @@ class BranchSpec: QuickSpec {
|
||||
describe("Branch(pointer)") {
|
||||
it("should initialize its properties") {
|
||||
let repo = Fixtures.mantleRepository
|
||||
let branch = from_git_reference(repo, "refs/heads/master") { Branch($0)! }
|
||||
let branch = from_git_reference(repo, name: "refs/heads/master") { Branch($0)! }
|
||||
expect(branch.longName).to(equal("refs/heads/master"))
|
||||
expect(branch.name).to(equal("master"))
|
||||
expect(branch.shortName).to(equal(branch.name))
|
||||
@ -78,7 +78,7 @@ class BranchSpec: QuickSpec {
|
||||
|
||||
it("should work with symoblic refs") {
|
||||
let repo = Fixtures.mantleRepository
|
||||
let branch = from_git_reference(repo, "refs/remotes/origin/HEAD") { Branch($0)! }
|
||||
let branch = from_git_reference(repo, name: "refs/remotes/origin/HEAD") { Branch($0)! }
|
||||
expect(branch.longName).to(equal("refs/remotes/origin/HEAD"))
|
||||
expect(branch.name).to(equal("origin/HEAD"))
|
||||
expect(branch.shortName).to(equal(branch.name))
|
||||
@ -92,15 +92,15 @@ class BranchSpec: QuickSpec {
|
||||
describe("==(Branch, Branch)") {
|
||||
it("should be true with equal branches") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let branch1 = from_git_reference(repo, "refs/heads/master") { Branch($0)! }
|
||||
let branch2 = from_git_reference(repo, "refs/heads/master") { Branch($0)! }
|
||||
let branch1 = from_git_reference(repo, name: "refs/heads/master") { Branch($0)! }
|
||||
let branch2 = from_git_reference(repo, name: "refs/heads/master") { Branch($0)! }
|
||||
expect(branch1).to(equal(branch2))
|
||||
}
|
||||
|
||||
it("should be false with unequal branches") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let branch1 = from_git_reference(repo, "refs/heads/master") { Branch($0)! }
|
||||
let branch2 = from_git_reference(repo, "refs/heads/another-branch") { Branch($0)! }
|
||||
let branch1 = from_git_reference(repo, name: "refs/heads/master") { Branch($0)! }
|
||||
let branch2 = from_git_reference(repo, name: "refs/heads/another-branch") { Branch($0)! }
|
||||
expect(branch1).notTo(equal(branch2))
|
||||
}
|
||||
}
|
||||
@ -108,8 +108,8 @@ class BranchSpec: QuickSpec {
|
||||
describe("Branch.hashValue") {
|
||||
it("should be equal with equal references") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let branch1 = from_git_reference(repo, "refs/heads/master") { Branch($0)! }
|
||||
let branch2 = from_git_reference(repo, "refs/heads/master") { Branch($0)! }
|
||||
let branch1 = from_git_reference(repo, name: "refs/heads/master") { Branch($0)! }
|
||||
let branch2 = from_git_reference(repo, name: "refs/heads/master") { Branch($0)! }
|
||||
expect(branch1.hashValue).to(equal(branch2.hashValue))
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,7 @@ class TagReferenceSpec: QuickSpec {
|
||||
describe("TagReference(pointer)") {
|
||||
it("should work with an annotated tag") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let tag = from_git_reference(repo, "refs/tags/tag-2") { TagReference($0)! }
|
||||
let tag = from_git_reference(repo, name: "refs/tags/tag-2") { TagReference($0)! }
|
||||
expect(tag.longName).to(equal("refs/tags/tag-2"))
|
||||
expect(tag.name).to(equal("tag-2"))
|
||||
expect(tag.shortName).to(equal(tag.name))
|
||||
@ -130,7 +130,7 @@ class TagReferenceSpec: QuickSpec {
|
||||
|
||||
it("should work with a lightweight tag") {
|
||||
let repo = Fixtures.mantleRepository
|
||||
let tag = from_git_reference(repo, "refs/tags/1.5.4") { TagReference($0)! }
|
||||
let tag = from_git_reference(repo, name: "refs/tags/1.5.4") { TagReference($0)! }
|
||||
expect(tag.longName).to(equal("refs/tags/1.5.4"))
|
||||
expect(tag.name).to(equal("1.5.4"))
|
||||
expect(tag.shortName).to(equal(tag.name))
|
||||
@ -139,7 +139,7 @@ class TagReferenceSpec: QuickSpec {
|
||||
|
||||
it("should return nil if not a tag") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let tag = from_git_reference(repo, "refs/heads/master") { TagReference($0) }
|
||||
let tag = from_git_reference(repo, name: "refs/heads/master") { TagReference($0) }
|
||||
expect(tag).to(beNil())
|
||||
}
|
||||
}
|
||||
@ -147,24 +147,24 @@ class TagReferenceSpec: QuickSpec {
|
||||
describe("==(TagReference, TagReference)") {
|
||||
it("should be true with equal tag references") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let tag1 = from_git_reference(repo, "refs/tags/tag-2") { TagReference($0)! }
|
||||
let tag2 = from_git_reference(repo, "refs/tags/tag-2") { TagReference($0)! }
|
||||
let tag1 = from_git_reference(repo, name: "refs/tags/tag-2") { TagReference($0)! }
|
||||
let tag2 = from_git_reference(repo, name: "refs/tags/tag-2") { TagReference($0)! }
|
||||
expect(tag1).to(equal(tag2))
|
||||
}
|
||||
|
||||
it("should be false with unequal tag references") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let tag1 = from_git_reference(repo, "refs/tags/tag-1") { TagReference($0)! }
|
||||
let tag2 = from_git_reference(repo, "refs/tags/tag-2") { TagReference($0)! }
|
||||
let tag1 = from_git_reference(repo, name: "refs/tags/tag-1") { TagReference($0)! }
|
||||
let tag2 = from_git_reference(repo, name: "refs/tags/tag-2") { TagReference($0)! }
|
||||
expect(tag1).notTo(equal(tag2))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
describe("TagReference.hashValue") {
|
||||
it("should be equal with equal references") {
|
||||
let repo = Fixtures.simpleRepository
|
||||
let tag1 = from_git_reference(repo, "refs/tags/tag-2") { TagReference($0)! }
|
||||
let tag2 = from_git_reference(repo, "refs/tags/tag-2") { TagReference($0)! }
|
||||
let tag1 = from_git_reference(repo, name: "refs/tags/tag-2") { TagReference($0)! }
|
||||
let tag2 = from_git_reference(repo, name: "refs/tags/tag-2") { TagReference($0)! }
|
||||
expect(tag1.hashValue).to(equal(tag2.hashValue))
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ class RemoteSpec: QuickSpec {
|
||||
describe("Remote(pointer)") {
|
||||
it("should initialize its properties") {
|
||||
let repo = Fixtures.mantleRepository
|
||||
let remote = with_git_remote(repo, "upstream") { Remote($0) }
|
||||
let remote = with_git_remote(repo, name: "upstream") { Remote($0) }
|
||||
|
||||
expect(remote.name).to(equal("upstream"))
|
||||
expect(remote.URL).to(equal("git@github.com:Mantle/Mantle.git"))
|
||||
@ -37,15 +37,15 @@ class RemoteSpec: QuickSpec {
|
||||
describe("==(Remote, Remote)") {
|
||||
it("should be true with equal objects") {
|
||||
let repo = Fixtures.mantleRepository
|
||||
let remote1 = with_git_remote(repo, "upstream") { Remote($0) }
|
||||
let remote1 = with_git_remote(repo, name: "upstream") { Remote($0) }
|
||||
let remote2 = remote1
|
||||
expect(remote1).to(equal(remote2))
|
||||
}
|
||||
|
||||
it("should be false with unequal objcets") {
|
||||
let repo = Fixtures.mantleRepository
|
||||
let origin = with_git_remote(repo, "origin") { Remote($0) }
|
||||
let upstream = with_git_remote(repo, "upstream") { Remote($0) }
|
||||
let origin = with_git_remote(repo, name: "origin") { Remote($0) }
|
||||
let upstream = with_git_remote(repo, name: "upstream") { Remote($0) }
|
||||
expect(origin).notTo(equal(upstream))
|
||||
}
|
||||
}
|
||||
@ -53,7 +53,7 @@ class RemoteSpec: QuickSpec {
|
||||
describe("Remote.hashValue") {
|
||||
it("should be equal with equal objcets") {
|
||||
let repo = Fixtures.mantleRepository
|
||||
let remote1 = with_git_remote(repo, "upstream") { Remote($0) }
|
||||
let remote1 = with_git_remote(repo, name: "upstream") { Remote($0) }
|
||||
let remote2 = remote1
|
||||
expect(remote1.hashValue).to(equal(remote2.hashValue))
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ class RepositorySpec: QuickSpec {
|
||||
}
|
||||
|
||||
it("should fail if the repo doesn't exist") {
|
||||
let url = NSURL(fileURLWithPath: "blah")!
|
||||
let url = NSURL(fileURLWithPath: "blah")
|
||||
let result = Repository.atURL(url)
|
||||
expect(result).to(haveFailed(beAnError(
|
||||
domain: equal(libGit2ErrorDomain),
|
||||
@ -358,8 +358,8 @@ class RepositorySpec: QuickSpec {
|
||||
"upstream/subclassing-notes",
|
||||
]
|
||||
let expected = expectedNames.map { repo.remoteBranchWithName($0).value! }
|
||||
let actual = repo.remoteBranches().value!.sorted {
|
||||
return lexicographicalCompare($0.longName, $1.longName)
|
||||
let actual = repo.remoteBranches().value!.sort {
|
||||
return $0.longName.characters.lexicographicalCompare($1.longName.characters)
|
||||
}
|
||||
expect(actual).to(equal(expected))
|
||||
expect(actual.map { $0.name }).to(equal(expectedNames))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user