updated to Swift 2.0

updated to Xcode 7.2 recommended settings
integrated with Nimble (v3.0.0), Quick (v0.8.0), Result (1.0.1)
integrated with Guanaco (5031bf67297afbe61ac0f2fbf3e3e8400b3f8888) that supports Swift 2.0
This commit is contained in:
Markos Charatzas 2016-01-16 14:57:32 +00:00
parent 44fd952378
commit 5c8a6000c4
28 changed files with 289 additions and 177 deletions

View File

@ -1 +1 @@
github "antitypical/Result" ~> 0.4.1 github "antitypical/Result" ~> 1.0.1

View File

@ -1,4 +1,4 @@
github "jspahrsummers/xcconfigs" >= 0.7.2 github "jspahrsummers/xcconfigs" >= 0.7.2
github "Quick/Quick" "155f858bce082373fc60d0c0a63415bf336c676b" github "Quick/Quick" "v0.8.0"
github "Quick/Nimble" ~> 0.4.1 github "Quick/Nimble" ~> 3.0.0
github "modocache/Guanaco" "26b6ceff4b8912abd0dfc3a9eed0a46527e040e3" github "modocache/Guanaco" "5031bf67297afbe61ac0f2fbf3e3e8400b3f8888"

View File

@ -1,6 +1,5 @@
github "robrix/Box" "1.2.2" github "modocache/Guanaco" "5031bf67297afbe61ac0f2fbf3e3e8400b3f8888"
github "modocache/Guanaco" "26b6ceff4b8912abd0dfc3a9eed0a46527e040e3" github "Quick/Nimble" "v3.0.0"
github "Quick/Nimble" "v0.4.2" github "Quick/Quick" "v0.8.0"
github "Quick/Quick" "155f858bce082373fc60d0c0a63415bf336c676b" github "antitypical/Result" "1.0.1"
github "jspahrsummers/xcconfigs" "0.8" github "jspahrsummers/xcconfigs" "0.8.1"
github "antitypical/Result" "0.4.1"

@ -1 +0,0 @@
Subproject commit bbe4e612a03ffe0bbb0e2e476c2be4534b6777a5

@ -1 +1 @@
Subproject commit 26b6ceff4b8912abd0dfc3a9eed0a46527e040e3 Subproject commit 5031bf67297afbe61ac0f2fbf3e3e8400b3f8888

@ -1 +1 @@
Subproject commit 8927113f877f32c8a01b41b746c4ac261b42c48e Subproject commit 676d1c8aedd09253229474a5dca2fddbf3b445a1

@ -1 +1 @@
Subproject commit 155f858bce082373fc60d0c0a63415bf336c676b Subproject commit 46b38c9c06b068baede09586aa281a6f075b2494

@ -1 +1 @@
Subproject commit 7ae33c66eb7ed815d6066f2e9ecc372091423832 Subproject commit 1a2c456268f4106f1b9b9e107920851f7fd2a8cd

@ -1 +1 @@
Subproject commit 813127f87f66fa14a7da03d3fa8410c02d2075d6 Subproject commit d78854b22b9567e7f30d748bdd4966c86bcc93a5

View File

@ -634,7 +634,8 @@
BEB31F1A1A0D6F7A00F525B9 /* Project object */ = { BEB31F1A1A0D6F7A00F525B9 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0630; LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "GitHub, Inc"; ORGANIZATIONNAME = "GitHub, Inc";
TargetAttributes = { TargetAttributes = {
BEB31F221A0D6F7A00F525B9 = { BEB31F221A0D6F7A00F525B9 = {
@ -765,6 +766,7 @@
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99; GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
@ -868,6 +870,7 @@
"-lcrypto", "-lcrypto",
"-lssl", "-lssl",
); );
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = SwiftGit2; PRODUCT_NAME = SwiftGit2;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -897,6 +900,7 @@
"-lcrypto", "-lcrypto",
"-lssl", "-lssl",
); );
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = SwiftGit2; PRODUCT_NAME = SwiftGit2;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
}; };
@ -917,6 +921,7 @@
); );
INFOPLIST_FILE = SwiftGit2Tests/Info.plist; INFOPLIST_FILE = SwiftGit2Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };
name = Debug; name = Debug;
@ -932,6 +937,7 @@
); );
INFOPLIST_FILE = SwiftGit2Tests/Info.plist; INFOPLIST_FILE = SwiftGit2Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };
name = Release; name = Release;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0630" LastUpgradeVersion = "0720"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
@ -23,10 +23,10 @@
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction <TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES">
buildConfiguration = "Debug">
<Testables> <Testables>
<TestableReference <TestableReference
skipped = "NO"> skipped = "NO">
@ -39,15 +39,18 @@
</BuildableReference> </BuildableReference>
</TestableReference> </TestableReference>
</Testables> </Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"> allowLocationSimulation = "YES">
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
@ -62,10 +65,10 @@
</AdditionalOptions> </AdditionalOptions>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES"> debugDocumentVersioning = "YES">
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference

View File

@ -4,9 +4,6 @@
<FileRef <FileRef
location = "group:SwiftGit2.xcodeproj"> location = "group:SwiftGit2.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Carthage/Checkouts/Box/Box.xcodeproj">
</FileRef>
<FileRef <FileRef
location = "group:Carthage/Checkouts/Result/Result.xcodeproj"> location = "group:Carthage/Checkouts/Result/Result.xcodeproj">
</FileRef> </FileRef>

View File

@ -0,0 +1,107 @@
{
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "0B2A3BCB00C86293DA74B6A9239BA502F6488D88+++937A20B",
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
},
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"95438028B10BBB846574013D29F154A00556A9D1+++D5553EB" : 0,
"D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64+++8BD7695" : 0,
"57C931977B7D2307CC013C2BD93F90CF7C676790+++139D2B1" : 0,
"956D2B21DD155C49504BB67697A67F7C5351A353+++5CC92F5" : 0,
"E35CE1831829A79469F2167CADA9B1D9BA6B0BA6+++3D78C67" : 0,
"956D2B21DD155C49504BB67697A67F7C5351A353+++0FC0BCD" : 0,
"95438028B10BBB846574013D29F154A00556A9D1+++5AB1F94" : 0,
"956D2B21DD155C49504BB67697A67F7C5351A353+++3988B36" : 0,
"0B2A3BCB00C86293DA74B6A9239BA502F6488D88+++937A20B" : 0,
"E084C86B03F81D63323C9E7510697EA528A758C7+++9C11E0D" : 0,
"57C931977B7D2307CC013C2BD93F90CF7C676790+++27D14BF" : 0,
"57C931977B7D2307CC013C2BD93F90CF7C676790+++8DA764B" : 0,
"70783EE7218D87FCBAABD7787F6E3A25EFFAFB2F+++E1067AA" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "ABD5A4E5-DBDA-485E-A4B2-44A76138E5AA",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"95438028B10BBB846574013D29F154A00556A9D1+++D5553EB" : "SwiftGit2\/Carthage\/Checkouts\/Nimble\/",
"D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64+++8BD7695" : "SwiftGit2\/Carthage\/Checkouts\/Quick\/",
"57C931977B7D2307CC013C2BD93F90CF7C676790+++139D2B1" : "SwiftGit2\/Carthage\/Checkouts\/Result\/Carthage\/Checkouts\/Box\/",
"956D2B21DD155C49504BB67697A67F7C5351A353+++5CC92F5" : "SwiftGit2\/Carthage\/Checkouts\/Result\/",
"E35CE1831829A79469F2167CADA9B1D9BA6B0BA6+++3D78C67" : "SwiftGit2\/Carthage\/Checkouts\/Guanaco\/",
"956D2B21DD155C49504BB67697A67F7C5351A353+++0FC0BCD" : "SwiftGit2\/Carthage\/Checkouts\/Guanaco\/External\/Result\/",
"95438028B10BBB846574013D29F154A00556A9D1+++5AB1F94" : "SwiftGit2\/Carthage\/Checkouts\/Nimble\/",
"956D2B21DD155C49504BB67697A67F7C5351A353+++3988B36" : "SwiftGit2\/Carthage\/Checkouts\/Result\/",
"0B2A3BCB00C86293DA74B6A9239BA502F6488D88+++937A20B" : "SwiftGit2\/",
"E084C86B03F81D63323C9E7510697EA528A758C7+++9C11E0D" : "SwiftGit2\/Carthage\/Checkouts\/xcconfigs\/",
"57C931977B7D2307CC013C2BD93F90CF7C676790+++27D14BF" : "SwiftGit2\/Carthage\/Checkouts\/Box\/",
"57C931977B7D2307CC013C2BD93F90CF7C676790+++8DA764B" : "SwiftGit2\/Carthage\/Checkouts\/Box\/",
"70783EE7218D87FCBAABD7787F6E3A25EFFAFB2F+++E1067AA" : "SwiftGit2\/External\/libgit2\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "SwiftGit2",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "SwiftGit2.xcworkspace",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:windmill-io\/SwiftGit2.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "0B2A3BCB00C86293DA74B6A9239BA502F6488D88+++937A20B"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Box.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "57C931977B7D2307CC013C2BD93F90CF7C676790+++139D2B1"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Box.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "57C931977B7D2307CC013C2BD93F90CF7C676790+++27D14BF"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/robrix\/Box.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "57C931977B7D2307CC013C2BD93F90CF7C676790+++8DA764B"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/libgit2\/libgit2.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "70783EE7218D87FCBAABD7787F6E3A25EFFAFB2F+++E1067AA"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Quick\/Nimble.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "95438028B10BBB846574013D29F154A00556A9D1+++5AB1F94"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Quick\/Nimble.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "95438028B10BBB846574013D29F154A00556A9D1+++D5553EB"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/antitypical\/Result",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "956D2B21DD155C49504BB67697A67F7C5351A353+++0FC0BCD"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/antitypical\/Result.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "956D2B21DD155C49504BB67697A67F7C5351A353+++3988B36"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/antitypical\/Result",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "956D2B21DD155C49504BB67697A67F7C5351A353+++5CC92F5"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Quick\/Quick.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64+++8BD7695"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/jspahrsummers\/xcconfigs.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "E084C86B03F81D63323C9E7510697EA528A758C7+++9C11E0D"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/modocache\/Guanaco.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "E35CE1831829A79469F2167CADA9B1D9BA6B0BA6+++3D78C67"
}
]
}

View File

@ -8,7 +8,7 @@
/// The flags defining how a checkout should be performed. /// The flags defining how a checkout should be performed.
/// More detail is available in the libgit2 documentation for `git_checkout_strategy_t`. /// 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 private let value: UInt
// MARK: - Initialization // MARK: - Initialization
@ -23,11 +23,11 @@ public struct CheckoutStrategy : RawOptionSetType {
} }
public init(_ strategy: git_checkout_strategy_t) { public init(_ strategy: git_checkout_strategy_t) {
self.value = UInt(strategy.value) self.value = UInt(strategy.rawValue)
} }
public static var allZeros: CheckoutStrategy { public static var allZeros: CheckoutStrategy {
return self(rawValue: 0) return self.init(rawValue: 0)
} }
// MARK: - Properties // MARK: - Properties

View File

@ -40,7 +40,7 @@ private func errorMessage(errorCode: Int32) -> String? {
let last = giterr_last() let last = giterr_last()
if last != nil { if last != nil {
return String.fromCString(last.memory.message) 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)) return String.fromCString(strerror(errno))
} else { } else {
return nil return nil

View File

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>org.libgit2.$(PRODUCT_NAME:rfc1034identifier)</string> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>

View File

@ -7,7 +7,7 @@
// //
func == (lhs: git_otype, rhs: git_otype) -> Bool { func == (lhs: git_otype, rhs: git_otype) -> Bool {
return lhs.value == rhs.value return lhs.rawValue == rhs.rawValue
} }
extension git_strarray { extension git_strarray {
@ -16,7 +16,7 @@ extension git_strarray {
} }
func map<T>(f: (String) -> T) -> [T] { 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)])! let string = String.fromCString(self.strings[Int($0)])!
return f(string) return f(string)
} }

View File

@ -26,7 +26,7 @@ public struct OID {
let pointer = UnsafeMutablePointer<git_oid>.alloc(1) let pointer = UnsafeMutablePointer<git_oid>.alloc(1)
let result = git_oid_fromstr(pointer, string) let result = git_oid_fromstr(pointer, string)
if result < GIT_OK.value { if result < GIT_OK.rawValue {
pointer.dealloc(1) pointer.dealloc(1)
return nil; return nil;
} }
@ -45,7 +45,7 @@ public struct OID {
public let oid: git_oid public let oid: git_oid
} }
extension OID: Printable { extension OID: CustomStringConvertible {
public var description: String { public var description: String {
let length = Int(GIT_OID_RAWSZ) * 2 let length = Int(GIT_OID_RAWSZ) * 2
let string = UnsafeMutablePointer<Int8>.alloc(length) let string = UnsafeMutablePointer<Int8>.alloc(length)
@ -68,7 +68,7 @@ extension OID: Hashable {
self.oid.id.6, self.oid.id.6,
self.oid.id.7 self.oid.id.7
] ]
return reduce(bytes, 0, { (hash, byte) in return bytes.reduce(0, combine:{ (hash, byte) in
return Int(hash << 8) | Int(byte) return Int(hash << 8) | Int(byte)
}) })
} }

View File

@ -88,7 +88,7 @@ public struct Commit: ObjectType {
committer = Signature(git_commit_committer(pointer).memory) committer = Signature(git_commit_committer(pointer).memory)
tree = PointerTo(OID(git_commit_tree_id(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)) 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`. /// Create an instance with a libgit2 `git_tree_entry`.
public init(_ pointer: COpaquePointer) { public init(_ pointer: COpaquePointer) {
let oid = OID(git_tree_entry_id(pointer).memory) 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))! object = Pointer(oid: oid, type: git_tree_entry_type(pointer))!
name = String.fromCString(git_tree_entry_name(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 { public var description: String {
return "\(attributes) \(object) \(name)" return "\(attributes) \(object) \(name)"
} }

View File

@ -20,7 +20,7 @@ public protocol PointerType: Equatable, Hashable {
} }
public func == <P: PointerType>(lhs: P, rhs: P) -> Bool { 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. /// A pointer to a git object.
@ -45,27 +45,29 @@ public enum Pointer: PointerType {
public var type: git_otype { public var type: git_otype {
switch self { switch self {
case let Commit(oid): case Commit(oid):
return GIT_OBJ_COMMIT return GIT_OBJ_COMMIT
case let Tree(oid): case Tree(oid):
return GIT_OBJ_TREE return GIT_OBJ_TREE
case let Blob(oid): case Blob(oid):
return GIT_OBJ_BLOB return GIT_OBJ_BLOB
case let Tag(oid): case Tag(oid):
return GIT_OBJ_TAG return GIT_OBJ_TAG
default:
return GIT_OBJ_ANY
} }
} }
/// Create an instance with an OID and a libgit2 `git_otype`. /// Create an instance with an OID and a libgit2 `git_otype`.
init?(oid: OID, type: git_otype) { init?(oid: OID, type: git_otype) {
switch type.value { switch type {
case GIT_OBJ_COMMIT.value: case GIT_OBJ_COMMIT:
self = Commit(oid) self = Commit(oid)
case GIT_OBJ_TREE.value: case GIT_OBJ_TREE:
self = Tree(oid) self = Tree(oid)
case GIT_OBJ_BLOB.value: case GIT_OBJ_BLOB:
self = Blob(oid) self = Blob(oid)
case GIT_OBJ_TAG.value: case GIT_OBJ_TAG:
self = Tag(oid) self = Tag(oid)
default: default:
return nil return nil
@ -79,7 +81,7 @@ extension Pointer: Hashable {
} }
} }
extension Pointer: Printable { extension Pointer: CustomStringConvertible {
public var description: String { public var description: String {
switch self { switch self {
case Commit: case Commit:

View File

@ -96,7 +96,7 @@ public struct Branch: ReferenceType {
public init?(_ pointer: COpaquePointer) { public init?(_ pointer: COpaquePointer) {
let namePointer = UnsafeMutablePointer<UnsafePointer<Int8>>.alloc(1) let namePointer = UnsafeMutablePointer<UnsafePointer<Int8>>.alloc(1)
let success = git_branch_name(namePointer, pointer) let success = git_branch_name(namePointer, pointer)
if success != GIT_OK.value { if success != GIT_OK.rawValue {
namePointer.dealloc(1) namePointer.dealloc(1)
return nil return nil
} }
@ -106,10 +106,10 @@ public struct Branch: ReferenceType {
longName = String.fromCString(git_reference_name(pointer))! longName = String.fromCString(git_reference_name(pointer))!
var oid: OID 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 var resolved: COpaquePointer = nil
let success = git_reference_resolve(&resolved, pointer) let success = git_reference_resolve(&resolved, pointer)
if success != GIT_OK.value { if success != GIT_OK.rawValue {
return nil return nil
} }
oid = OID(git_reference_target(resolved).memory) oid = OID(git_reference_target(resolved).memory)
@ -184,7 +184,7 @@ public enum TagReference: ReferenceType {
var pointer: COpaquePointer = nil var pointer: COpaquePointer = nil
let result = git_object_lookup(&pointer, repo, &oid, GIT_OBJ_TAG) 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)) self = .Annotated(name, Tag(pointer))
} else { } else {
self = .Lightweight(name, OID(oid)) self = .Lightweight(name, OID(oid))

View File

@ -25,12 +25,12 @@ final public class Repository {
var pointer: COpaquePointer = nil var pointer: COpaquePointer = nil
let result = git_repository_open(&pointer, URL.fileSystemRepresentation) let result = git_repository_open(&pointer, URL.fileSystemRepresentation)
if result != GIT_OK.value { if result != GIT_OK.rawValue {
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_open")) return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_open"))
} }
let repository = Repository(pointer) let repository = Repository(pointer)
return Result.success(repository) return Result.Success(repository)
} }
// MARK: - Initializers // MARK: - Initializers
@ -74,8 +74,8 @@ final public class Repository {
var oid = oid.oid var oid = oid.oid
let result = git_object_lookup(&pointer, self.pointer, &oid, type) let result = git_object_lookup(&pointer, self.pointer, &oid, type)
if result != GIT_OK.value { if result != GIT_OK.rawValue {
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_object_lookup")) return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_object_lookup"))
} }
let value = transform(pointer) 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> { 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. /// Loads the object with the given OID.
@ -96,13 +96,13 @@ final public class Repository {
return withLibgit2Object(oid, type: GIT_OBJ_ANY) { object in return withLibgit2Object(oid, type: GIT_OBJ_ANY) { object in
let type = git_object_type(object) let type = git_object_type(object)
if type == Blob.type { if type == Blob.type {
return Result.success(Blob(object)) return Result.Success(Blob(object))
} else if type == Commit.type { } else if type == Commit.type {
return Result.success(Commit(object)) return Result.Success(Commit(object))
} else if type == Tag.type { } else if type == Tag.type {
return Result.success(Tag(object)) return Result.Success(Tag(object))
} else if type == Tree.type { } else if type == Tree.type {
return Result.success(Tree(object)) return Result.Success(Tree(object))
} }
let error = NSError( let error = NSError(
@ -112,7 +112,7 @@ final public class Repository {
NSLocalizedDescriptionKey: "Unrecognized git_otype '\(type)' for oid '\(oid)'." NSLocalizedDescriptionKey: "Unrecognized git_otype '\(type)' for oid '\(oid)'."
] ]
) )
return Result.failure(error) return Result.Failure(error)
} }
} }
@ -188,9 +188,9 @@ final public class Repository {
let pointer = UnsafeMutablePointer<git_strarray>.alloc(1) let pointer = UnsafeMutablePointer<git_strarray>.alloc(1)
let result = git_remote_list(pointer, self.pointer) let result = git_remote_list(pointer, self.pointer)
if result != GIT_OK.value { if result != GIT_OK.rawValue {
pointer.dealloc(1) 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 let strarray = pointer.memory
@ -202,9 +202,9 @@ final public class Repository {
let error = remotes.reduce(nil) { $0 == nil ? $0 : $1.error } let error = remotes.reduce(nil) { $0 == nil ? $0 : $1.error }
if let error = 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. /// Load a remote from the repository.
@ -216,13 +216,13 @@ final public class Repository {
var pointer: COpaquePointer = nil var pointer: COpaquePointer = nil
let result = git_remote_lookup(&pointer, self.pointer, name) let result = git_remote_lookup(&pointer, self.pointer, name)
if result != GIT_OK.value { if result != GIT_OK.rawValue {
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_lookup")) return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_lookup"))
} }
let value = Remote(pointer) let value = Remote(pointer)
git_remote_free(pointer) git_remote_free(pointer)
return Result.success(value) return Result.Success(value)
} }
// MARK: - Reference Lookups // MARK: - Reference Lookups
@ -232,9 +232,9 @@ final public class Repository {
let pointer = UnsafeMutablePointer<git_strarray>.alloc(1) let pointer = UnsafeMutablePointer<git_strarray>.alloc(1)
let result = git_reference_list(pointer, self.pointer) let result = git_reference_list(pointer, self.pointer)
if result != GIT_OK.value { if result != GIT_OK.rawValue {
pointer.dealloc(1) 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 let strarray = pointer.memory
@ -244,15 +244,15 @@ final public class Repository {
} }
.map { .map {
self.referenceWithName($0) self.referenceWithName($0)
} }
git_strarray_free(pointer) git_strarray_free(pointer)
pointer.dealloc(1) pointer.dealloc(1)
let error = references.reduce(nil) { $0 == nil ? $0 : $1.error } let error = references.reduce(nil) { $0 == nil ? $0 : $1.error }
if let error = 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") /// 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 var pointer: COpaquePointer = nil
let result = git_reference_lookup(&pointer, self.pointer, name) let result = git_reference_lookup(&pointer, self.pointer, name)
if result != GIT_OK.value { if result != GIT_OK.rawValue {
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_lookup")) return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_lookup"))
} }
let value = referenceWithLibGit2Reference(pointer) let value = referenceWithLibGit2Reference(pointer)
git_reference_free(pointer) git_reference_free(pointer)
return Result.success(value) return Result.Success(value)
} }
/// Load and return a list of all local branches. /// Load and return a list of all local branches.
@ -278,7 +278,7 @@ final public class Repository {
return referencesWithPrefix("refs/heads/") return referencesWithPrefix("refs/heads/")
.map { (refs: [ReferenceType]) in .map { (refs: [ReferenceType]) in
return refs.map { $0 as! Branch } return refs.map { $0 as! Branch }
} }
} }
/// Load and return a list of all remote branches. /// Load and return a list of all remote branches.
@ -286,7 +286,7 @@ final public class Repository {
return referencesWithPrefix("refs/remotes/") return referencesWithPrefix("refs/remotes/")
.map { (refs: [ReferenceType]) in .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"). /// Load the local branch with the given name (e.g., "master").
@ -304,7 +304,7 @@ final public class Repository {
return referencesWithPrefix("refs/tags/") return referencesWithPrefix("refs/tags/")
.map { (refs: [ReferenceType]) in .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"). /// Load the tag with the given name (e.g., "tag-2").
@ -320,12 +320,12 @@ final public class Repository {
public func HEAD() -> Result<ReferenceType, NSError> { public func HEAD() -> Result<ReferenceType, NSError> {
var pointer: COpaquePointer = nil var pointer: COpaquePointer = nil
let result = git_repository_head(&pointer, self.pointer) let result = git_repository_head(&pointer, self.pointer)
if result != GIT_OK.value { if result != GIT_OK.rawValue {
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_head")) return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_head"))
} }
let value = referenceWithLibGit2Reference(pointer) let value = referenceWithLibGit2Reference(pointer)
git_reference_free(pointer) git_reference_free(pointer)
return Result.success(value) return Result.Success(value)
} }
/// Set HEAD to the given oid (detached). /// Set HEAD to the given oid (detached).
@ -335,10 +335,10 @@ final public class Repository {
public func setHEAD(oid: OID) -> Result<(), NSError> { public func setHEAD(oid: OID) -> Result<(), NSError> {
var oid = oid.oid var oid = oid.oid
let result = git_repository_set_head_detached(self.pointer, &oid); let result = git_repository_set_head_detached(self.pointer, &oid);
if result != GIT_OK.value { if result != GIT_OK.rawValue {
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head")) return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
} }
return Result.success() return Result.Success()
} }
/// Set HEAD to the given reference. /// 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. /// :returns: Returns a result with void or the error that occurred.
public func setHEAD(reference: ReferenceType) -> Result<(), NSError> { public func setHEAD(reference: ReferenceType) -> Result<(), NSError> {
let result = git_repository_set_head(self.pointer, reference.longName); let result = git_repository_set_head(self.pointer, reference.longName);
if result != GIT_OK.value { if result != GIT_OK.rawValue {
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head")) return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
} }
return Result.success() return Result.Success()
} }
/// Check out HEAD. /// Check out HEAD.
@ -358,16 +358,16 @@ final public class Repository {
/// :param: strategy The checkout strategy to use. /// :param: strategy The checkout strategy to use.
/// :param: progress A block that's called with the progress of the checkout. /// :param: progress A block that's called with the progress of the checkout.
/// :returns: Returns a result with void or the error that occurred. /// :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) 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) let result = git_checkout_head(self.pointer, &options)
if result != GIT_OK.value { if result != GIT_OK.rawValue {
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_checkout_head")) return Result.Failure(libGit2Error(result, libGit2PointOfFailure: "git_checkout_head"))
} }
return Result.success() return Result.Success()
} }
/// Check out the given OID. /// Check out the given OID.

View File

@ -21,10 +21,9 @@ final class Fixtures {
} }
init() { init() {
let path = NSTemporaryDirectory() directoryURL = NSURL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
.stringByAppendingPathComponent("org.libgit2.SwiftGit2") .URLByAppendingPathComponent("org.libgit2.SwiftGit2")
.stringByAppendingPathComponent(NSProcessInfo.processInfo().globallyUniqueString) .URLByAppendingPathComponent(NSProcessInfo.processInfo().globallyUniqueString)
directoryURL = NSURL.fileURLWithPath(path, isDirectory: true)!
} }
// MARK: - Setup and Teardown // MARK: - Setup and Teardown
@ -32,10 +31,10 @@ final class Fixtures {
let directoryURL: NSURL let directoryURL: NSURL
func setUp() { 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 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 { for URL in zipURLs {
unzipFileAtURL(URL, intoDirectoryAtURL: directoryURL) unzipFileAtURL(URL, intoDirectoryAtURL: directoryURL)
@ -43,7 +42,7 @@ final class Fixtures {
} }
func tearDown() { func tearDown() {
NSFileManager.defaultManager().removeItemAtURL(directoryURL, error: nil) try! NSFileManager.defaultManager().removeItemAtURL(directoryURL)
} }
func unzipFileAtURL(fileURL: NSURL, intoDirectoryAtURL directoryURL: NSURL) { func unzipFileAtURL(fileURL: NSURL, intoDirectoryAtURL directoryURL: NSURL) {

View File

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>org.libgit2.$(PRODUCT_NAME:rfc1034identifier)</string> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>

View File

@ -30,7 +30,7 @@ class SignatureSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! 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) let signature = Signature(raw_signature)
expect(signature.name).to(equal("Matt Diephouse")) expect(signature.name).to(equal("Matt Diephouse"))
@ -45,7 +45,7 @@ class SignatureSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! 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) Signature(git_commit_author(commit).memory)
} }
let author2 = author1 let author2 = author1
@ -58,10 +58,10 @@ class SignatureSpec: QuickSpec {
let oid1 = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! let oid1 = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
let oid2 = OID(string: "24e1e40ee77525d9e279f079f9906ad6d98c8940")! 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) 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) Signature(git_commit_author(commit).memory)
} }
@ -74,7 +74,7 @@ class SignatureSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! 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) Signature(git_commit_author(commit).memory)
} }
let author2 = author1 let author2 = author1
@ -92,11 +92,11 @@ class CommitSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "24e1e40ee77525d9e279f079f9906ad6d98c8940")! let oid = OID(string: "24e1e40ee77525d9e279f079f9906ad6d98c8940")!
let commit = from_git_object(repo, oid) { Commit($0) } let commit = from_git_object(repo, oid: oid) { Commit($0) }
let author = from_git_object(repo, oid) { commit in let author = from_git_object(repo, oid: oid) { commit in
Signature(git_commit_author(commit).memory) 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) Signature(git_commit_committer(commit).memory)
} }
let tree = PointerTo<Tree>(OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!) let tree = PointerTo<Tree>(OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!)
@ -115,7 +115,7 @@ class CommitSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! 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([])) expect(commit.parents).to(equal([]))
} }
@ -123,7 +123,7 @@ class CommitSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "c4ed03a6b7d7ce837d31d83757febbe84dd465fd")! 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>] = [ let parents: [PointerTo<Commit>] = [
PointerTo(OID(string: "315b3f344221db91ddc54b269f3c9af422da0f2e")!), PointerTo(OID(string: "315b3f344221db91ddc54b269f3c9af422da0f2e")!),
PointerTo(OID(string: "57f6197561d1f99b03c160f4026a07f06b43cf20")!), PointerTo(OID(string: "57f6197561d1f99b03c160f4026a07f06b43cf20")!),
@ -137,7 +137,7 @@ class CommitSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! 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 let commit2 = commit1
expect(commit1).to(equal(commit2)) expect(commit1).to(equal(commit2))
} }
@ -147,8 +147,8 @@ class CommitSpec: QuickSpec {
let oid1 = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! let oid1 = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!
let oid2 = OID(string: "c4ed03a6b7d7ce837d31d83757febbe84dd465fd")! let oid2 = OID(string: "c4ed03a6b7d7ce837d31d83757febbe84dd465fd")!
let commit1 = from_git_object(repo, oid1) { Commit($0) } let commit1 = from_git_object(repo, oid: oid1) { Commit($0) }
let commit2 = from_git_object(repo, oid2) { Commit($0) } let commit2 = from_git_object(repo, oid: oid2) { Commit($0) }
expect(commit1).notTo(equal(commit2)) expect(commit1).notTo(equal(commit2))
} }
} }
@ -158,7 +158,7 @@ class CommitSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")! 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 let commit2 = commit1
expect(commit1.hashValue).to(equal(commit2.hashValue)) expect(commit1.hashValue).to(equal(commit2.hashValue))
} }
@ -170,7 +170,7 @@ class TreeEntrySpec: QuickSpec {
override func spec() { override func spec() {
describe("Tree.Entry(attributes:object:name:)") { describe("Tree.Entry(attributes:object:name:)") {
it("should set its properties") { 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 object = Pointer.Blob(OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!)
let name = "README.md" let name = "README.md"
@ -186,8 +186,8 @@ class TreeEntrySpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")! let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
let entry = from_git_object(repo, oid) { Tree.Entry(git_tree_entry_byindex($0, 0)) } 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.value))) expect(entry.attributes).to(equal(Int32(GIT_FILEMODE_BLOB.rawValue)))
expect(entry.object).to(equal(Pointer.Blob(OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!))) expect(entry.object).to(equal(Pointer.Blob(OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!)))
expect(entry.name).to(equal("README.md")) expect(entry.name).to(equal("README.md"))
} }
@ -198,7 +198,7 @@ class TreeEntrySpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")! 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 let entry2 = entry1
expect(entry1).to(equal(entry2)) expect(entry1).to(equal(entry2))
} }
@ -208,8 +208,8 @@ class TreeEntrySpec: QuickSpec {
let oid1 = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")! let oid1 = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
let oid2 = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")! let oid2 = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
let entry1 = from_git_object(repo, oid1) { 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, oid2) { 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)) expect(entry1).notTo(equal(entry2))
} }
} }
@ -219,7 +219,7 @@ class TreeEntrySpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")! 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 let entry2 = entry1
expect(entry1.hashValue).to(equal(entry2.hashValue)) expect(entry1.hashValue).to(equal(entry2.hashValue))
} }
@ -234,9 +234,9 @@ class TreeSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")! 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 = [ 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)) expect(tree.entries).to(equal(entries))
} }
@ -247,7 +247,7 @@ class TreeSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")! 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 let tree2 = tree1
expect(tree1).to(equal(tree2)) expect(tree1).to(equal(tree2))
} }
@ -257,8 +257,8 @@ class TreeSpec: QuickSpec {
let oid1 = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")! let oid1 = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")!
let oid2 = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")! let oid2 = OID(string: "f93e3a1a1525fb5b91020da86e44810c87a2d7bc")!
let tree1 = from_git_object(repo, oid1) { Tree($0) } let tree1 = from_git_object(repo, oid: oid1) { Tree($0) }
let tree2 = from_git_object(repo, oid2) { Tree($0) } let tree2 = from_git_object(repo, oid: oid2) { Tree($0) }
expect(tree1).notTo(equal(tree2)) expect(tree1).notTo(equal(tree2))
} }
} }
@ -268,7 +268,7 @@ class TreeSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "219e9f39c2fb59ed1dfb3e78ed75055a57528f31")! 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 let tree2 = tree1
expect(tree1.hashValue).to(equal(tree2.hashValue)) expect(tree1.hashValue).to(equal(tree2.hashValue))
} }
@ -283,7 +283,7 @@ class BlobSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")! 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 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)! let data = (contents as NSString).dataUsingEncoding(NSUTF8StringEncoding)!
expect(blob.oid).to(equal(oid)) expect(blob.oid).to(equal(oid))
@ -296,7 +296,7 @@ class BlobSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")! 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 let blob2 = blob1
expect(blob1).to(equal(blob2)) expect(blob1).to(equal(blob2))
} }
@ -306,8 +306,8 @@ class BlobSpec: QuickSpec {
let oid1 = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")! let oid1 = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")!
let oid2 = OID(string: "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391")! let oid2 = OID(string: "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391")!
let blob1 = from_git_object(repo, oid1) { Blob($0) } let blob1 = from_git_object(repo, oid: oid1) { Blob($0) }
let blob2 = from_git_object(repo, oid2) { Blob($0) } let blob2 = from_git_object(repo, oid: oid2) { Blob($0) }
expect(blob1).notTo(equal(blob2)) expect(blob1).notTo(equal(blob2))
} }
} }
@ -317,7 +317,7 @@ class BlobSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "41078396f5187daed5f673e4a13b185bbad71fba")! 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 let blob2 = blob1
expect(blob1.hashValue).to(equal(blob2.hashValue)) expect(blob1.hashValue).to(equal(blob2.hashValue))
} }
@ -332,8 +332,8 @@ class TagSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")! let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")!
let tag = from_git_object(repo, oid) { Tag($0) } let tag = from_git_object(repo, oid: oid) { Tag($0) }
let tagger = from_git_object(repo, oid) { Signature(git_tag_tagger($0).memory) } let tagger = from_git_object(repo, oid: oid) { Signature(git_tag_tagger($0).memory) }
expect(tag.oid).to(equal(oid)) expect(tag.oid).to(equal(oid))
expect(tag.target).to(equal(Pointer.Commit(OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!))) expect(tag.target).to(equal(Pointer.Commit(OID(string: "dc220a3f0c22920dab86d4a8d3a3cb7e69d6205a")!)))
@ -348,7 +348,7 @@ class TagSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")! 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 let tag2 = tag1
expect(tag1).to(equal(tag2)) expect(tag1).to(equal(tag2))
} }
@ -358,8 +358,8 @@ class TagSpec: QuickSpec {
let oid1 = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")! let oid1 = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")!
let oid2 = OID(string: "13bda91157f255ab224ff88d0a11a82041c9d0c1")! let oid2 = OID(string: "13bda91157f255ab224ff88d0a11a82041c9d0c1")!
let tag1 = from_git_object(repo, oid1) { Tag($0) } let tag1 = from_git_object(repo, oid: oid1) { Tag($0) }
let tag2 = from_git_object(repo, oid2) { Tag($0) } let tag2 = from_git_object(repo, oid: oid2) { Tag($0) }
expect(tag1).notTo(equal(tag2)) expect(tag1).notTo(equal(tag2))
} }
} }
@ -369,7 +369,7 @@ class TagSpec: QuickSpec {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let oid = OID(string: "57943b8ee00348180ceeedc960451562750f6d33")! 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 let tag2 = tag1
expect(tag1.hashValue).to(equal(tag2.hashValue)) expect(tag1.hashValue).to(equal(tag2.hashValue))
} }

View File

@ -27,7 +27,7 @@ class ReferenceSpec: QuickSpec {
describe("Reference(pointer)") { describe("Reference(pointer)") {
it("should initialize its properties") { it("should initialize its properties") {
let repo = Fixtures.simpleRepository 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.longName).to(equal("refs/heads/master"))
expect(ref.shortName).to(equal("master")) expect(ref.shortName).to(equal("master"))
expect(ref.oid).to(equal(OID(string: "c4ed03a6b7d7ce837d31d83757febbe84dd465fd")!)) expect(ref.oid).to(equal(OID(string: "c4ed03a6b7d7ce837d31d83757febbe84dd465fd")!))
@ -37,15 +37,15 @@ class ReferenceSpec: QuickSpec {
describe("==(Reference, Reference)") { describe("==(Reference, Reference)") {
it("should be true with equal references") { it("should be true with equal references") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let ref1 = 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, "refs/heads/master") { Reference($0) } let ref2 = from_git_reference(repo, name: "refs/heads/master") { Reference($0) }
expect(ref1).to(equal(ref2)) expect(ref1).to(equal(ref2))
} }
it("should be false with unequal references") { it("should be false with unequal references") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let ref1 = 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, "refs/heads/another-branch") { Reference($0) } let ref2 = from_git_reference(repo, name: "refs/heads/another-branch") { Reference($0) }
expect(ref1).notTo(equal(ref2)) expect(ref1).notTo(equal(ref2))
} }
} }
@ -53,8 +53,8 @@ class ReferenceSpec: QuickSpec {
describe("Reference.hashValue") { describe("Reference.hashValue") {
it("should be equal with equal references") { it("should be equal with equal references") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let ref1 = 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, "refs/heads/master") { Reference($0) } let ref2 = from_git_reference(repo, name: "refs/heads/master") { Reference($0) }
expect(ref1.hashValue).to(equal(ref2.hashValue)) expect(ref1.hashValue).to(equal(ref2.hashValue))
} }
} }
@ -66,7 +66,7 @@ class BranchSpec: QuickSpec {
describe("Branch(pointer)") { describe("Branch(pointer)") {
it("should initialize its properties") { it("should initialize its properties") {
let repo = Fixtures.mantleRepository 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.longName).to(equal("refs/heads/master"))
expect(branch.name).to(equal("master")) expect(branch.name).to(equal("master"))
expect(branch.shortName).to(equal(branch.name)) expect(branch.shortName).to(equal(branch.name))
@ -78,7 +78,7 @@ class BranchSpec: QuickSpec {
it("should work with symoblic refs") { it("should work with symoblic refs") {
let repo = Fixtures.mantleRepository 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.longName).to(equal("refs/remotes/origin/HEAD"))
expect(branch.name).to(equal("origin/HEAD")) expect(branch.name).to(equal("origin/HEAD"))
expect(branch.shortName).to(equal(branch.name)) expect(branch.shortName).to(equal(branch.name))
@ -92,15 +92,15 @@ class BranchSpec: QuickSpec {
describe("==(Branch, Branch)") { describe("==(Branch, Branch)") {
it("should be true with equal branches") { it("should be true with equal branches") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let branch1 = 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, "refs/heads/master") { Branch($0)! } let branch2 = from_git_reference(repo, name: "refs/heads/master") { Branch($0)! }
expect(branch1).to(equal(branch2)) expect(branch1).to(equal(branch2))
} }
it("should be false with unequal branches") { it("should be false with unequal branches") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let branch1 = 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, "refs/heads/another-branch") { Branch($0)! } let branch2 = from_git_reference(repo, name: "refs/heads/another-branch") { Branch($0)! }
expect(branch1).notTo(equal(branch2)) expect(branch1).notTo(equal(branch2))
} }
} }
@ -108,8 +108,8 @@ class BranchSpec: QuickSpec {
describe("Branch.hashValue") { describe("Branch.hashValue") {
it("should be equal with equal references") { it("should be equal with equal references") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let branch1 = 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, "refs/heads/master") { Branch($0)! } let branch2 = from_git_reference(repo, name: "refs/heads/master") { Branch($0)! }
expect(branch1.hashValue).to(equal(branch2.hashValue)) expect(branch1.hashValue).to(equal(branch2.hashValue))
} }
} }
@ -121,7 +121,7 @@ class TagReferenceSpec: QuickSpec {
describe("TagReference(pointer)") { describe("TagReference(pointer)") {
it("should work with an annotated tag") { it("should work with an annotated tag") {
let repo = Fixtures.simpleRepository 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.longName).to(equal("refs/tags/tag-2"))
expect(tag.name).to(equal("tag-2")) expect(tag.name).to(equal("tag-2"))
expect(tag.shortName).to(equal(tag.name)) expect(tag.shortName).to(equal(tag.name))
@ -130,7 +130,7 @@ class TagReferenceSpec: QuickSpec {
it("should work with a lightweight tag") { it("should work with a lightweight tag") {
let repo = Fixtures.mantleRepository 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.longName).to(equal("refs/tags/1.5.4"))
expect(tag.name).to(equal("1.5.4")) expect(tag.name).to(equal("1.5.4"))
expect(tag.shortName).to(equal(tag.name)) expect(tag.shortName).to(equal(tag.name))
@ -139,7 +139,7 @@ class TagReferenceSpec: QuickSpec {
it("should return nil if not a tag") { it("should return nil if not a tag") {
let repo = Fixtures.simpleRepository 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()) expect(tag).to(beNil())
} }
} }
@ -147,15 +147,15 @@ class TagReferenceSpec: QuickSpec {
describe("==(TagReference, TagReference)") { describe("==(TagReference, TagReference)") {
it("should be true with equal tag references") { it("should be true with equal tag references") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let tag1 = 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, "refs/tags/tag-2") { TagReference($0)! } let tag2 = from_git_reference(repo, name: "refs/tags/tag-2") { TagReference($0)! }
expect(tag1).to(equal(tag2)) expect(tag1).to(equal(tag2))
} }
it("should be false with unequal tag references") { it("should be false with unequal tag references") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let tag1 = from_git_reference(repo, "refs/tags/tag-1") { TagReference($0)! } let tag1 = from_git_reference(repo, name: "refs/tags/tag-1") { TagReference($0)! }
let tag2 = from_git_reference(repo, "refs/tags/tag-2") { TagReference($0)! } let tag2 = from_git_reference(repo, name: "refs/tags/tag-2") { TagReference($0)! }
expect(tag1).notTo(equal(tag2)) expect(tag1).notTo(equal(tag2))
} }
} }
@ -163,8 +163,8 @@ class TagReferenceSpec: QuickSpec {
describe("TagReference.hashValue") { describe("TagReference.hashValue") {
it("should be equal with equal references") { it("should be equal with equal references") {
let repo = Fixtures.simpleRepository let repo = Fixtures.simpleRepository
let tag1 = 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, "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)) expect(tag1.hashValue).to(equal(tag2.hashValue))
} }
} }

View File

@ -27,7 +27,7 @@ class RemoteSpec: QuickSpec {
describe("Remote(pointer)") { describe("Remote(pointer)") {
it("should initialize its properties") { it("should initialize its properties") {
let repo = Fixtures.mantleRepository 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.name).to(equal("upstream"))
expect(remote.URL).to(equal("git@github.com:Mantle/Mantle.git")) expect(remote.URL).to(equal("git@github.com:Mantle/Mantle.git"))
@ -37,15 +37,15 @@ class RemoteSpec: QuickSpec {
describe("==(Remote, Remote)") { describe("==(Remote, Remote)") {
it("should be true with equal objects") { it("should be true with equal objects") {
let repo = Fixtures.mantleRepository 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 let remote2 = remote1
expect(remote1).to(equal(remote2)) expect(remote1).to(equal(remote2))
} }
it("should be false with unequal objcets") { it("should be false with unequal objcets") {
let repo = Fixtures.mantleRepository let repo = Fixtures.mantleRepository
let origin = with_git_remote(repo, "origin") { Remote($0) } let origin = with_git_remote(repo, name: "origin") { Remote($0) }
let upstream = with_git_remote(repo, "upstream") { Remote($0) } let upstream = with_git_remote(repo, name: "upstream") { Remote($0) }
expect(origin).notTo(equal(upstream)) expect(origin).notTo(equal(upstream))
} }
} }
@ -53,7 +53,7 @@ class RemoteSpec: QuickSpec {
describe("Remote.hashValue") { describe("Remote.hashValue") {
it("should be equal with equal objcets") { it("should be equal with equal objcets") {
let repo = Fixtures.mantleRepository 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 let remote2 = remote1
expect(remote1.hashValue).to(equal(remote2.hashValue)) expect(remote1.hashValue).to(equal(remote2.hashValue))
} }

View File

@ -21,7 +21,7 @@ class RepositorySpec: QuickSpec {
} }
it("should fail if the repo doesn't exist") { it("should fail if the repo doesn't exist") {
let url = NSURL(fileURLWithPath: "blah")! let url = NSURL(fileURLWithPath: "blah")
let result = Repository.atURL(url) let result = Repository.atURL(url)
expect(result).to(haveFailed(beAnError( expect(result).to(haveFailed(beAnError(
domain: equal(libGit2ErrorDomain), domain: equal(libGit2ErrorDomain),
@ -358,8 +358,8 @@ class RepositorySpec: QuickSpec {
"upstream/subclassing-notes", "upstream/subclassing-notes",
] ]
let expected = expectedNames.map { repo.remoteBranchWithName($0).value! } let expected = expectedNames.map { repo.remoteBranchWithName($0).value! }
let actual = repo.remoteBranches().value!.sorted { let actual = repo.remoteBranches().value!.sort {
return lexicographicalCompare($0.longName, $1.longName) return $0.longName.characters.lexicographicalCompare($1.longName.characters)
} }
expect(actual).to(equal(expected)) expect(actual).to(equal(expected))
expect(actual.map { $0.name }).to(equal(expectedNames)) expect(actual.map { $0.name }).to(equal(expectedNames))