Skip to content

Commit dae0b10

Browse files
committed
Merge branch 'master' into pull
# Conflicts: # ObjectiveGitFramework.xcodeproj/project.pbxproj
2 parents 4feb8c6 + 6e5a9d9 commit dae0b10

27 files changed

+867
-125
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "Carthage/Checkouts/xcconfigs"]
1717
path = Carthage/Checkouts/xcconfigs
1818
url = https://github.com/jspahrsummers/xcconfigs.git
19+
[submodule "Carthage/Checkouts/ZipArchive"]
20+
path = Carthage/Checkouts/ZipArchive
21+
url = https://github.com/ZipArchive/ZipArchive.git

Cartfile.private

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
github "jspahrsummers/xcconfigs" >= 0.7.1
22
github "Quick/Quick" ~> 0.3
33
github "Quick/Nimble" ~> 0.4
4+
github "ZipArchive/ZipArchive" ~> 0.3

Cartfile.resolved

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
github "Quick/Nimble" "v0.4.2"
22
github "Quick/Quick" "v0.3.1"
3+
github "ZipArchive/ZipArchive" "v0.3.2"
34
github "jspahrsummers/xcconfigs" "0.7.2"

Carthage/Checkouts/ZipArchive

Submodule ZipArchive added at 60312c1

ObjectiveGit/GTBranch.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ NS_ASSUME_NONNULL_BEGIN
132132
/// Returns whether the calculation was successful.
133133
- (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind relativeTo:(GTBranch *)branch error:(NSError **)error;
134134

135-
#pragma mark Deprecations
136-
- (nullable GTCommit *)targetCommitAndReturnError:(NSError **)error __deprecated_msg("use targetCommitWithError: instead.");
137-
138135
@end
139136

140137
NS_ASSUME_NONNULL_END

ObjectiveGit/GTBranch.m

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,4 @@ - (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind relativeTo:(GTBra
223223
return [self.repository calculateAhead:ahead behind:behind ofOID:self.OID relativeToOID:branch.OID error:error];
224224
}
225225

226-
#pragma mark Deprecations
227-
- (GTCommit *)targetCommitAndReturnError:(NSError **)error {
228-
return [self targetCommitWithError:error];
229-
}
230-
231226
@end

ObjectiveGit/GTCredential.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ NS_ASSUME_NONNULL_BEGIN
7474
/// Return a new GTCredential instance, or nil if an error occurred
7575
+ (nullable instancetype)credentialWithUserName:(NSString *)userName publicKeyURL:(nullable NSURL *)publicKeyURL privateKeyURL:(NSURL *)privateKeyURL passphrase:(nullable NSString *)passphrase error:(NSError **)error;
7676

77+
/// Create a credential object from a SSH keyfile data string
78+
///
79+
/// userName - The username to authenticate as.
80+
/// publicKeyString - The string containing the public key for that user.
81+
/// Can be omitted to reconstruct the public key from the private key.
82+
/// privateKeyString - The URL to the private key for that user.
83+
/// passphrase - The passPhrase for the private key. Optional if the private key has no password.
84+
/// error - If not NULL, set to any errors that occur.
85+
///
86+
/// Return a new GTCredential instance, or nil if an error occurred
87+
+ (nullable instancetype)credentialWithUserName:(NSString *)userName publicKeyString:(nullable NSString *)publicKeyString privateKeyString:(NSString *)privateKeyString passphrase:(nullable NSString *)passphrase error:(NSError **)error;
88+
7789
/// The underlying `git_cred` object.
7890
- (git_cred *)git_cred __attribute__((objc_returns_inner_pointer));
7991

ObjectiveGit/GTCredential.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ + (instancetype)credentialWithUserName:(NSString *)userName publicKeyURL:(NSURL
7171
return [[self alloc] initWithGitCred:cred];
7272
}
7373

74+
+ (instancetype)credentialWithUserName:(NSString *)userName publicKeyString:(NSString *)publicKeyString privateKeyString:(NSString *)privateKeyString passphrase:(NSString *)passphrase error:(NSError **)error {
75+
NSParameterAssert(privateKeyString != nil);
76+
77+
git_cred *cred;
78+
int gitError = git_cred_ssh_key_memory_new(&cred, userName.UTF8String, publicKeyString.UTF8String, privateKeyString.UTF8String, passphrase.UTF8String);
79+
if (gitError != GIT_OK) {
80+
if (error) *error = [NSError git_errorFor:gitError description:@"Failed to create credentials object" failureReason:@"There was an error creating a credential object for username %@ with the provided public/private key pair.\nPublic key: %@\nPrivate key: %@", userName, publicKeyString, privateKeyString];
81+
return nil;
82+
}
83+
84+
return [[self alloc] initWithGitCred:cred];
85+
}
86+
7487
- (instancetype)initWithGitCred:(git_cred *)cred {
7588
NSParameterAssert(cred != nil);
7689
self = [self init];

ObjectiveGit/GTRepository+RemoteOperations.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions
219219

220220
git_remote_callbacks remote_callbacks = GIT_REMOTE_CALLBACKS_INIT;
221221
remote_callbacks.credentials = (credProvider != nil ? GTCredentialAcquireCallback : NULL),
222-
remote_callbacks.transfer_progress = GTRemoteFetchTransferProgressCallback,
222+
remote_callbacks.push_transfer_progress = GTRemotePushTransferProgressCallback;
223223
remote_callbacks.payload = &connectionInfo,
224224

225225
gitError = git_remote_connect(remote.git_remote, GIT_DIRECTION_PUSH, &remote_callbacks);
@@ -239,6 +239,8 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions
239239
return NO;
240240
}
241241

242+
push_options.callbacks = remote_callbacks;
243+
242244
const git_strarray git_refspecs = refspecs.git_strarray;
243245

244246
gitError = git_remote_upload(remote.git_remote, &git_refspecs, &push_options);

0 commit comments

Comments
 (0)