Merge pull request #126 from Maaimusic/swift-4.1

update to Swift 4
This commit is contained in:
Matt Diephouse 2018-04-30 20:36:50 -04:00 committed by GitHub
commit 280ab5b473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 13 deletions

View File

@ -1,6 +1,7 @@
language: objective-c
osx_image: xcode9.2
os: osx
osx_image: xcode9.3
sudo: false # Enable container-based builds

View File

@ -57,6 +57,7 @@
622726341C84E52500C53D17 /* Credentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = 622726331C84E52500C53D17 /* Credentials.swift */; };
622726351C84E52500C53D17 /* Credentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = 622726331C84E52500C53D17 /* Credentials.swift */; };
62E6FD8F1C727E9C00A312B0 /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62E6FD8E1C727E9C00A312B0 /* ZipArchive.framework */; };
8F9A51F2209596A40037C3A6 /* repository-with-status.zip in Resources */ = {isa = PBXBuildFile; fileRef = 237731C61F46542B0020A3FE /* repository-with-status.zip */; };
BE0991F71A578FB1007D4E6A /* Mantle.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0991F61A578FB1007D4E6A /* Mantle.zip */; };
BE0B1C5D1A9978890004726D /* detached-head.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0B1C5C1A9978890004726D /* detached-head.zip */; };
BE14AA501A1974010015B439 /* SwiftGit2.m in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA4F1A1974010015B439 /* SwiftGit2.m */; };
@ -653,6 +654,7 @@
buildActionMask = 2147483647;
files = (
621E66C81C72958D00A0F352 /* detached-head.zip in Resources */,
8F9A51F2209596A40037C3A6 /* repository-with-status.zip in Resources */,
621E66C91C72958D00A0F352 /* Mantle.zip in Resources */,
621E66CA1C72958D00A0F352 /* simple-repository.zip in Resources */,
);

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -27,12 +27,12 @@ public struct OID {
let result = git_oid_fromstr(pointer, string)
if result < GIT_OK.rawValue {
pointer.deallocate(capacity: 1)
pointer.deallocate()
return nil
}
oid = pointer.pointee
pointer.deallocate(capacity: 1)
pointer.deallocate()
}
/// Create an instance from a libgit2 `git_oid`.

View File

@ -147,7 +147,7 @@ public enum TagReference: ReferenceType {
/// The short human-readable name of the branch (e.g., `master`).
public var name: String {
return longName.substring(from: "refs/tags/".endIndex)
return String(longName["refs/tags/".endIndex...])
}
/// The OID of the target object.

View File

@ -23,7 +23,7 @@ private func checkoutProgressCallback(path: UnsafePointer<Int8>?, completedSteps
block = buffer.pointee
} else {
block = buffer.move()
buffer.deallocate(capacity: 1)
buffer.deallocate()
}
block(path.flatMap(String.init(validatingUTF8:)), completedSteps, totalSteps)
}
@ -40,7 +40,7 @@ private func checkoutOptions(strategy: CheckoutStrategy,
let pointer = UnsafeMutablePointer<git_checkout_options>.allocate(capacity: 1)
git_checkout_init_options(pointer, UInt32(GIT_CHECKOUT_OPTIONS_VERSION))
var options = pointer.move()
pointer.deallocate(capacity: 1)
pointer.deallocate()
options.checkout_strategy = strategy.gitCheckoutStrategy.rawValue
@ -60,7 +60,7 @@ private func fetchOptions(credentials: Credentials) -> git_fetch_options {
var options = pointer.move()
pointer.deallocate(capacity: 1)
pointer.deallocate()
options.callbacks.payload = credentials.toPointer()
options.callbacks.credentials = credentialsCallback
@ -75,7 +75,7 @@ private func cloneOptions(bare: Bool = false, localClone: Bool = false, fetchOpt
var options = pointer.move()
pointer.deallocate(capacity: 1)
pointer.deallocate()
options.bare = bare ? 1 : 0
@ -350,7 +350,7 @@ final public class Repository {
let result = git_remote_list(pointer, self.pointer)
guard result == GIT_OK.rawValue else {
pointer.deallocate(capacity: 1)
pointer.deallocate()
return Result.failure(NSError(gitError: result, pointOfFailure: "git_remote_list"))
}
@ -359,7 +359,7 @@ final public class Repository {
return self.remote(named: $0)
}
git_strarray_free(pointer)
pointer.deallocate(capacity: 1)
pointer.deallocate()
let error = remotes.reduce(nil) { $0 == nil ? $0 : $1.error }
if let error = error {
@ -416,7 +416,7 @@ final public class Repository {
let result = git_reference_list(pointer, self.pointer)
guard result == GIT_OK.rawValue else {
pointer.deallocate(capacity: 1)
pointer.deallocate()
return Result.failure(NSError(gitError: result, pointOfFailure: "git_reference_list"))
}
@ -429,7 +429,7 @@ final public class Repository {
self.reference(named: $0)
}
git_strarray_free(pointer)
pointer.deallocate(capacity: 1)
pointer.deallocate()
let error = references.reduce(nil) { $0 == nil ? $0 : $1.error }
if let error = error {
@ -790,7 +790,7 @@ final public class Repository {
return .failure(NSError(gitError: optionsResult, pointOfFailure: "git_status_init_options"))
}
var options = pointer.move()
pointer.deallocate(capacity: 1)
pointer.deallocate()
var unsafeStatus: OpaquePointer? = nil
defer { git_status_list_free(unsafeStatus) }