Skip to content

Commit f6b8483

Browse files
committed
Merge pull request SwiftGit2#43 from SwiftGit2/antitypical-result
Switch from LlamaKit to antitypical/Result
2 parents e550eea + 37bdb9e commit f6b8483

18 files changed

+52
-52
lines changed

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
[submodule "Carthage/Checkouts/Guanaco"]
55
path = Carthage/Checkouts/Guanaco
66
url = https://github.com/modocache/Guanaco.git
7-
[submodule "Carthage/Checkouts/LlamaKit"]
8-
path = Carthage/Checkouts/LlamaKit
9-
url = https://github.com/LlamaKit/LlamaKit.git
107
[submodule "Carthage/Checkouts/Nimble"]
118
path = Carthage/Checkouts/Nimble
129
url = https://github.com/Quick/Nimble.git
@@ -16,3 +13,6 @@
1613
[submodule "Carthage/Checkouts/xcconfigs"]
1714
path = Carthage/Checkouts/xcconfigs
1815
url = https://github.com/jspahrsummers/xcconfigs.git
16+
[submodule "Carthage/Checkouts/Result"]
17+
path = Carthage/Checkouts/Result
18+
url = https://github.com/antitypical/Result.git

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "LlamaKit/LlamaKit" ~> 0.6
1+
github "antitypical/Result"

Cartfile.private

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
github "jspahrsummers/xcconfigs" >= 0.7.2
22
github "Quick/Quick" "155f858bce082373fc60d0c0a63415bf336c676b"
33
github "Quick/Nimble" ~> 0.4.1
4-
github "modocache/Guanaco" "18126c0c8ba9a7cb3cc5d43aec83c81047410ab6"
4+
github "modocache/Guanaco" "26b6ceff4b8912abd0dfc3a9eed0a46527e040e3"

Cartfile.resolved

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github "modocache/Guanaco" "18126c0c8ba9a7cb3cc5d43aec83c81047410ab6"
2-
github "LlamaKit/LlamaKit" "v0.6.0"
3-
github "Quick/Nimble" "v0.4.1"
1+
github "modocache/Guanaco" "26b6ceff4b8912abd0dfc3a9eed0a46527e040e3"
2+
github "Quick/Nimble" "v0.4.2"
43
github "Quick/Quick" "155f858bce082373fc60d0c0a63415bf336c676b"
5-
github "jspahrsummers/xcconfigs" "0.7.2"
4+
github "antitypical/Result" "0.3"
5+
github "jspahrsummers/xcconfigs" "0.8"

Carthage/Checkouts/LlamaKit

Lines changed: 0 additions & 1 deletion
This file was deleted.

Carthage/Checkouts/Result

Submodule Result added at 1756b77

Carthage/Checkouts/xcconfigs

SwiftGit2.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
/* Begin PBXBuildFile section */
1010
BE0991F71A578FB1007D4E6A /* Mantle.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0991F61A578FB1007D4E6A /* Mantle.zip */; };
1111
BE0B1C5D1A9978890004726D /* detached-head.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0B1C5C1A9978890004726D /* detached-head.zip */; };
12-
BE14AA321A15AA510015B439 /* LlamaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE14AA311A15AA510015B439 /* LlamaKit.framework */; };
1312
BE14AA501A1974010015B439 /* SwiftGit2.m in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA4F1A1974010015B439 /* SwiftGit2.m */; };
1413
BE14AA551A1984550015B439 /* Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA541A1984550015B439 /* Fixtures.swift */; };
1514
BE14AA571A198C6E0015B439 /* simple-repository.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE14AA561A198C6E0015B439 /* simple-repository.zip */; };
@@ -90,6 +89,7 @@
9089
BECB5F6C1A56F1B400999413 /* ReferencesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */; };
9190
BECB5F6E1A57284700999413 /* Remotes.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6D1A57284700999413 /* Remotes.swift */; };
9291
BECB5F701A57286200999413 /* RemotesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6F1A57286200999413 /* RemotesSpec.swift */; };
92+
BEE591C71ADF470500534F14 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEE591C61ADF470500534F14 /* Result.framework */; };
9393
DA5023A01A969F1A004175D7 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA50239F1A969F1A004175D7 /* Nimble.framework */; };
9494
DA59146D1A94549A00AED74C /* Guanaco.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA59146C1A94549A00AED74C /* Guanaco.framework */; };
9595
DA5914761A94579000AED74C /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5914751A94579000AED74C /* Errors.swift */; };
@@ -187,7 +187,6 @@
187187
/* Begin PBXFileReference section */
188188
BE0991F61A578FB1007D4E6A /* Mantle.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Mantle.zip; sourceTree = "<group>"; };
189189
BE0B1C5C1A9978890004726D /* detached-head.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "detached-head.zip"; sourceTree = "<group>"; };
190-
BE14AA311A15AA510015B439 /* LlamaKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = LlamaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
191190
BE14AA4F1A1974010015B439 /* SwiftGit2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SwiftGit2.m; sourceTree = "<group>"; };
192191
BE14AA541A1984550015B439 /* Fixtures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Fixtures.swift; sourceTree = "<group>"; };
193192
BE14AA561A198C6E0015B439 /* simple-repository.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "simple-repository.zip"; sourceTree = "<group>"; };
@@ -291,6 +290,7 @@
291290
BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReferencesSpec.swift; sourceTree = "<group>"; };
292291
BECB5F6D1A57284700999413 /* Remotes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Remotes.swift; sourceTree = "<group>"; };
293292
BECB5F6F1A57286200999413 /* RemotesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemotesSpec.swift; sourceTree = "<group>"; };
293+
BEE591C61ADF470500534F14 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = "../../Library/Developer/Xcode/DerivedData/SwiftGit2-cdzquzvlxdewyddxgdgxjagqvjba/Build/Products/Debug/Result.framework"; sourceTree = "<group>"; };
294294
DA50239F1A969F1A004175D7 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; };
295295
DA59146C1A94549A00AED74C /* Guanaco.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Guanaco.framework; sourceTree = BUILT_PRODUCTS_DIR; };
296296
DA5914751A94579000AED74C /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = "<group>"; };
@@ -302,7 +302,7 @@
302302
isa = PBXFrameworksBuildPhase;
303303
buildActionMask = 2147483647;
304304
files = (
305-
BE14AA321A15AA510015B439 /* LlamaKit.framework in Frameworks */,
305+
BEE591C71ADF470500534F14 /* Result.framework in Frameworks */,
306306
BEB31FA01A0E595600F525B9 /* libz.dylib in Frameworks */,
307307
BEB31F9E1A0E595100F525B9 /* libiconv.dylib in Frameworks */,
308308
);
@@ -554,9 +554,9 @@
554554
BEB31FA11A0E63C100F525B9 /* Libraries */ = {
555555
isa = PBXGroup;
556556
children = (
557+
BEE591C61ADF470500534F14 /* Result.framework */,
557558
BEB31F9D1A0E595100F525B9 /* libiconv.dylib */,
558559
BEB31F9F1A0E595600F525B9 /* libz.dylib */,
559-
BE14AA311A15AA510015B439 /* LlamaKit.framework */,
560560
);
561561
name = Libraries;
562562
sourceTree = "<group>";

SwiftGit2.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SwiftGit2/OID.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
import Foundation
10-
import LlamaKit
10+
import Result
1111

1212
/// An identifier for a Git object.
1313
public struct OID {

SwiftGit2/Repository.swift

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
import Foundation
10-
import LlamaKit
10+
import Result
1111

1212
public typealias CheckoutProgressBlock = SG2CheckoutProgressBlock
1313

@@ -26,11 +26,11 @@ final public class Repository {
2626
let result = git_repository_open(&pointer, URL.fileSystemRepresentation)
2727

2828
if result != GIT_OK.value {
29-
return failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_open"))
29+
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_open"))
3030
}
3131

3232
let repository = Repository(pointer)
33-
return success(repository)
33+
return Result.success(repository)
3434
}
3535

3636
// MARK: - Initializers
@@ -75,7 +75,7 @@ final public class Repository {
7575
let result = git_object_lookup(&pointer, self.pointer, &oid, type)
7676

7777
if result != GIT_OK.value {
78-
return failure(libGit2Error(result, libGit2PointOfFailure: "git_object_lookup"))
78+
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_object_lookup"))
7979
}
8080

8181
let value = transform(pointer)
@@ -84,7 +84,7 @@ final public class Repository {
8484
}
8585

8686
func withLibgit2Object<T>(oid: OID, type: git_otype, transform: COpaquePointer -> T) -> Result<T, NSError> {
87-
return withLibgit2Object(oid, type: type) { success(transform($0)) }
87+
return withLibgit2Object(oid, type: type) { Result.success(transform($0)) }
8888
}
8989

9090
/// Loads the object with the given OID.
@@ -96,13 +96,13 @@ final public class Repository {
9696
return withLibgit2Object(oid, type: GIT_OBJ_ANY) { object in
9797
let type = git_object_type(object)
9898
if type == Blob.type {
99-
return success(Blob(object))
99+
return Result.success(Blob(object))
100100
} else if type == Commit.type {
101-
return success(Commit(object))
101+
return Result.success(Commit(object))
102102
} else if type == Tag.type {
103-
return success(Tag(object))
103+
return Result.success(Tag(object))
104104
} else if type == Tree.type {
105-
return success(Tree(object))
105+
return Result.success(Tree(object))
106106
}
107107

108108
let error = NSError(
@@ -112,7 +112,7 @@ final public class Repository {
112112
NSLocalizedDescriptionKey: "Unrecognized git_otype '\(type)' for oid '\(oid)'."
113113
]
114114
)
115-
return failure(error)
115+
return Result.failure(error)
116116
}
117117
}
118118

@@ -190,7 +190,7 @@ final public class Repository {
190190

191191
if result != GIT_OK.value {
192192
pointer.dealloc(1)
193-
return failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_list"))
193+
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_list"))
194194
}
195195

196196
let strarray = pointer.memory
@@ -202,9 +202,9 @@ final public class Repository {
202202

203203
let error = remotes.reduce(nil) { $0 == nil ? $0 : $1.error }
204204
if let error = error {
205-
return failure(error)
205+
return Result.failure(error)
206206
}
207-
return success(remotes.map { $0.value! })
207+
return Result.success(remotes.map { $0.value! })
208208
}
209209

210210
/// Load a remote from the repository.
@@ -217,12 +217,12 @@ final public class Repository {
217217
let result = git_remote_lookup(&pointer, self.pointer, name)
218218

219219
if result != GIT_OK.value {
220-
return failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_lookup"))
220+
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_lookup"))
221221
}
222222

223223
let value = Remote(pointer)
224224
git_remote_free(pointer)
225-
return success(value)
225+
return Result.success(value)
226226
}
227227

228228
// MARK: - Reference Lookups
@@ -234,7 +234,7 @@ final public class Repository {
234234

235235
if result != GIT_OK.value {
236236
pointer.dealloc(1)
237-
return failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_list"))
237+
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_list"))
238238
}
239239

240240
let strarray = pointer.memory
@@ -250,9 +250,9 @@ final public class Repository {
250250

251251
let error = references.reduce(nil) { $0 == nil ? $0 : $1.error }
252252
if let error = error {
253-
return failure(error)
253+
return Result.failure(error)
254254
}
255-
return success(references.map { $0.value! })
255+
return Result.success(references.map { $0.value! })
256256
}
257257

258258
/// Load the reference with the given long name (e.g. "refs/heads/master")
@@ -265,12 +265,12 @@ final public class Repository {
265265
let result = git_reference_lookup(&pointer, self.pointer, name)
266266

267267
if result != GIT_OK.value {
268-
return failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_lookup"))
268+
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_lookup"))
269269
}
270270

271271
let value = referenceWithLibGit2Reference(pointer)
272272
git_reference_free(pointer)
273-
return success(value)
273+
return Result.success(value)
274274
}
275275

276276
/// Load and return a list of all local branches.
@@ -321,11 +321,11 @@ final public class Repository {
321321
var pointer: COpaquePointer = nil
322322
let result = git_repository_head(&pointer, self.pointer)
323323
if result != GIT_OK.value {
324-
return failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_head"))
324+
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_head"))
325325
}
326326
let value = referenceWithLibGit2Reference(pointer)
327327
git_reference_free(pointer)
328-
return success(value)
328+
return Result.success(value)
329329
}
330330

331331
/// Set HEAD to the given oid (detached).
@@ -336,9 +336,9 @@ final public class Repository {
336336
var oid = oid.oid
337337
let result = git_repository_set_head_detached(self.pointer, &oid);
338338
if result != GIT_OK.value {
339-
return failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
339+
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
340340
}
341-
return success()
341+
return Result.success()
342342
}
343343

344344
/// Set HEAD to the given reference.
@@ -348,9 +348,9 @@ final public class Repository {
348348
public func setHEAD(reference: ReferenceType) -> Result<(), NSError> {
349349
let result = git_repository_set_head(self.pointer, reference.longName);
350350
if result != GIT_OK.value {
351-
return failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
351+
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
352352
}
353-
return success()
353+
return Result.success()
354354
}
355355

356356
/// Check out HEAD.
@@ -364,10 +364,10 @@ final public class Repository {
364364

365365
let result = git_checkout_head(self.pointer, &options)
366366
if result != GIT_OK.value {
367-
return failure(libGit2Error(result, libGit2PointOfFailure: "git_checkout_head"))
367+
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_checkout_head"))
368368
}
369369

370-
return success()
370+
return Result.success()
371371
}
372372

373373
/// Check out the given OID.

SwiftGit2Tests/OIDSpec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
77
//
88

9-
import LlamaKit
9+
import Result
1010
import SwiftGit2
1111
import Nimble
1212
import Quick

SwiftGit2Tests/ObjectsSpec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
77
//
88

9-
import LlamaKit
9+
import Result
1010
import SwiftGit2
1111
import Nimble
1212
import Quick

SwiftGit2Tests/ReferencesSpec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright (c) 2015 GitHub, Inc. All rights reserved.
77
//
88

9-
import LlamaKit
9+
import Result
1010
import SwiftGit2
1111
import Nimble
1212
import Quick

SwiftGit2Tests/RemotesSpec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright (c) 2015 GitHub, Inc. All rights reserved.
77
//
88

9-
import LlamaKit
9+
import Result
1010
import SwiftGit2
1111
import Nimble
1212
import Quick

SwiftGit2Tests/RepositorySpec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
77
//
88

9-
import LlamaKit
9+
import Result
1010
import SwiftGit2
1111
import Nimble
1212
import Quick

0 commit comments

Comments
 (0)