Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libgit2 1.0.0 #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion External/libgit2
Submodule libgit2 updated 699 files
2 changes: 1 addition & 1 deletion ObjectiveGit/GTCredential+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ typedef struct {
__unsafe_unretained GTCredentialProvider *credProvider;
} GTCredentialAcquireCallbackInfo;

int GTCredentialAcquireCallback(git_cred **cred, const char *url, const char *username_from_url, unsigned int allowed_types, void *payload);
int GTCredentialAcquireCallback(git_credential **cred, const char *url, const char *username_from_url, unsigned int allowed_types, void *payload);
14 changes: 7 additions & 7 deletions ObjectiveGit/GTCredential.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
#import "git2/transport.h"

/// An enum describing the data needed for authentication.
/// See `git_credtype_t`.
/// See `git_credential_t`.
typedef NS_ENUM(NSInteger, GTCredentialType) {
GTCredentialTypeUserPassPlaintext = GIT_CREDTYPE_USERPASS_PLAINTEXT,
GTCredentialTypeSSHKey = GIT_CREDTYPE_SSH_KEY,
GTCredentialTypeSSHCustom = GIT_CREDTYPE_SSH_CUSTOM,
GTCredentialTypeUserPassPlaintext = GIT_CREDENTIAL_USERPASS_PLAINTEXT,
GTCredentialTypeSSHKey = GIT_CREDENTIAL_SSH_KEY,
GTCredentialTypeSSHCustom = GIT_CREDENTIAL_SSH_CUSTOM,
};

NS_ASSUME_NONNULL_BEGIN
Expand Down Expand Up @@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN
@end

/// The GTCredential class is used to provide authentication data.
/// It acts as a wrapper around `git_cred` objects.
/// It acts as a wrapper around `git_credential` objects.
@interface GTCredential : NSObject

/// Create a credential object from a username/password pair.
Expand Down Expand Up @@ -86,8 +86,8 @@ NS_ASSUME_NONNULL_BEGIN
/// Return a new GTCredential instance, or nil if an error occurred
+ (instancetype _Nullable)credentialWithUserName:(NSString *)userName publicKeyString:(NSString * _Nullable)publicKeyString privateKeyString:(NSString *)privateKeyString passphrase:(NSString * _Nullable)passphrase error:(NSError **)error;

/// The underlying `git_cred` object.
- (git_cred *)git_cred __attribute__((objc_returns_inner_pointer));
/// The underlying `git_credential` object.
- (git_credential *)git_credential __attribute__((objc_returns_inner_pointer));

@end

Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTOID.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ + (instancetype)oidWithSHACString:(const char *)SHA {
}

- (BOOL)isZero {
return git_oid_iszero(self.git_oid) != 0;
return git_oid_is_zero(self.git_oid) != 0;
}

#pragma mark NSObject
Expand Down
8 changes: 4 additions & 4 deletions ObjectiveGit/GTRepository+Merging.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#import "GTOdbObject.h"
#import "GTObjectDatabase.h"

typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *stats, BOOL *stop);
typedef void (^GTRemoteFetchTransferProgressBlock)(const git_indexer_progress *stats, BOOL *stop);

@implementation GTRepository (Merging)

Expand Down Expand Up @@ -181,7 +181,7 @@ - (NSString * _Nullable)contentsOfDiffWithAncestor:(GTIndexEntry *)ancestor ourS

// initialize the ancestor's merge file input
git_merge_file_input ancestorInput;
int gitError = git_merge_file_init_input(&ancestorInput, GIT_MERGE_FILE_INPUT_VERSION);
int gitError = git_merge_file_input_init(&ancestorInput, GIT_MERGE_FILE_INPUT_VERSION);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create merge file input for ancestor"];
return nil;
Expand All @@ -199,7 +199,7 @@ - (NSString * _Nullable)contentsOfDiffWithAncestor:(GTIndexEntry *)ancestor ourS

// initialize our merge file input
git_merge_file_input ourInput;
gitError = git_merge_file_init_input(&ourInput, GIT_MERGE_FILE_INPUT_VERSION);
gitError = git_merge_file_options_init(&ourInput, GIT_MERGE_FILE_INPUT_VERSION);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create merge file input for our side"];
return nil;
Expand All @@ -217,7 +217,7 @@ - (NSString * _Nullable)contentsOfDiffWithAncestor:(GTIndexEntry *)ancestor ourS

// initialize their merge file input
git_merge_file_input theirInput;
gitError = git_merge_file_init_input(&theirInput, GIT_MERGE_FILE_INPUT_VERSION);
gitError = git_merge_file_input_init(&theirInput, GIT_MERGE_FILE_INPUT_VERSION);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create merge file input other side"];
return nil;
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTRepository+Pull.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

NS_ASSUME_NONNULL_BEGIN

typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *progress, BOOL *stop);
typedef void (^GTRemoteFetchTransferProgressBlock)(const git_indexer_progress *progress, BOOL *stop);

@interface GTRepository (Pull)

Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTRepository+RemoteOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) {
///
/// Returns YES if the fetch was successful, NO otherwise (and `error`, if provided,
/// will point to an error describing what happened).
- (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary * _Nullable)options error:(NSError **)error progress:(void (^ _Nullable)(const git_transfer_progress *stats, BOOL *stop))progressBlock;
- (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary * _Nullable)options error:(NSError **)error progress:(void (^ _Nullable)(const git_indexer_progress *stats, BOOL *stop))progressBlock;

/// Enumerate all available fetch head entries.
///
Expand Down
6 changes: 3 additions & 3 deletions ObjectiveGit/GTRepository+RemoteOperations.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
NSString *const GTRepositoryRemoteOptionsDownloadTags = @"GTRepositoryRemoteOptionsDownloadTags";
NSString *const GTRepositoryRemoteOptionsPushNotes = @"GTRepositoryRemoteOptionsPushNotes";

typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *stats, BOOL *stop);
typedef void (^GTRemoteFetchTransferProgressBlock)(const git_indexer_progress *stats, BOOL *stop);
typedef void (^GTRemotePushTransferProgressBlock)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop);

@implementation GTRepository (RemoteOperations)
Expand All @@ -45,7 +45,7 @@ @implementation GTRepository (RemoteOperations)
git_direction direction;
} GTRemoteConnectionInfo;

int GTRemoteFetchTransferProgressCallback(const git_transfer_progress *stats, void *payload) {
int GTRemoteFetchTransferProgressCallback(const git_indexer_progress *stats, void *payload) {
GTRemoteConnectionInfo *info = payload;
BOOL stop = NO;

Expand Down Expand Up @@ -281,7 +281,7 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions

git_push_options push_options = GIT_PUSH_OPTIONS_INIT;

gitError = git_push_init_options(&push_options, GIT_PUSH_OPTIONS_VERSION);
gitError = git_push_options_init(&push_options, GIT_PUSH_OPTIONS_VERSION);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to init push options"];
return NO;
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) {
/// May be NULL.
///
/// returns nil (and fills the error parameter) if an error occurred, or a GTRepository object if successful.
+ (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(NSDictionary * _Nullable)options error:(NSError **)error transferProgressBlock:(void (^ _Nullable)(const git_transfer_progress *, BOOL *stop))transferProgressBlock;
+ (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(NSDictionary * _Nullable)options error:(NSError **)error transferProgressBlock:(void (^ _Nullable)(const git_indexer_progress *, BOOL *stop))transferProgressBlock;

/// Lookup objects in the repo by oid or sha1
- (id _Nullable)lookUpObjectByOID:(GTOID *)oid objectType:(GTObjectType)type error:(NSError **)error;
Expand Down
6 changes: 3 additions & 3 deletions ObjectiveGit/GTRepository.m
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ - (instancetype)initWithURL:(NSURL *)localFileURL flags:(NSInteger)flags ceiling
}


typedef void(^GTTransferProgressBlock)(const git_transfer_progress *progress, BOOL *stop);
typedef void(^GTTransferProgressBlock)(const git_indexer_progress *progress, BOOL *stop);

static int transferProgressCallback(const git_transfer_progress *progress, void *payload) {
static int transferProgressCallback(const git_indexer_progress *progress, void *payload) {
if (payload == NULL) return 0;
struct GTClonePayload *pld = payload;
if (pld->transferProgressBlock == NULL) return 0;
Expand Down Expand Up @@ -244,7 +244,7 @@ static int remoteCreate(git_remote **remote, git_repository *repo, const char *n
git_remote_callbacks remoteCallbacks;
};

+ (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(NSDictionary * _Nullable)options error:(NSError **)error transferProgressBlock:(void (^ _Nullable)(const git_transfer_progress *, BOOL *stop))transferProgressBlock {
+ (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(NSDictionary * _Nullable)options error:(NSError **)error transferProgressBlock:(void (^ _Nullable)(const git_indexer_progress *, BOOL *stop))transferProgressBlock {

git_clone_options cloneOptions = GIT_CLONE_OPTIONS_INIT;

Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGitTests/GTRemoteSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@

__block unsigned int receivedObjects = 0;
__block BOOL transferProgressed = NO;
BOOL success = [fetchingRepo fetchRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *stats, BOOL *stop) {
BOOL success = [fetchingRepo fetchRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *stats, BOOL *stop) {
receivedObjects += stats->received_objects;
transferProgressed = YES;
}];
Expand Down
10 changes: 5 additions & 5 deletions ObjectiveGitTests/GTRepository+PullSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

// Pull
__block BOOL transferProgressed = NO;
BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) {
BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *progress, BOOL *stop) {
transferProgressed = YES;
}];
expect(error).to(beNil());
Expand Down Expand Up @@ -124,7 +124,7 @@
// Pull
__block BOOL transferProgressed = NO;
BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) {
BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *progress, BOOL *stop) {
transferProgressed = YES;
}];
expect(@(result)).to(beTruthy());
Expand Down Expand Up @@ -165,7 +165,7 @@

// Pull
__block BOOL transferProgressed = NO;
BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) {
BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *progress, BOOL *stop) {
transferProgressed = YES;
}];
expect(error).to(beNil());
Expand Down Expand Up @@ -219,7 +219,7 @@

// Pull
__block BOOL transferProgressed = NO;
BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) {
BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *progress, BOOL *stop) {
transferProgressed = YES;
}];
expect(@(result)).to(beTruthy());
Expand Down Expand Up @@ -251,7 +251,7 @@

// Pull
__block BOOL transferProgressed = NO;
BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) {
BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *progress, BOOL *stop) {
transferProgressed = YES;
}];
NSString *fileContents = [NSString stringWithContentsOfURL:[localRepo.fileURL URLByAppendingPathComponent:@"test.txt"] encoding:NSUTF8StringEncoding error:nil];
Expand Down
4 changes: 2 additions & 2 deletions ObjectiveGitTests/GTRepositorySpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
describe(@"+cloneFromURL:toWorkingDirectory:options:error:transferProgressBlock:checkoutProgressBlock:", ^{
__block BOOL transferProgressCalled = NO;
__block BOOL checkoutProgressCalled = NO;
__block void (^transferProgressBlock)(const git_transfer_progress *, BOOL *);
__block void (^transferProgressBlock)(const git_indexer_progress *, BOOL *);
__block void (^checkoutProgressBlock)(NSString *, NSUInteger, NSUInteger);
__block NSURL *originURL;
__block NSURL *workdirURL;
Expand All @@ -78,7 +78,7 @@
beforeEach(^{
transferProgressCalled = NO;
checkoutProgressCalled = NO;
transferProgressBlock = ^(const git_transfer_progress *progress, BOOL *stop) {
transferProgressBlock = ^(const git_indexer_progress *progress, BOOL *stop) {
transferProgressCalled = YES;
};
checkoutProgressBlock = ^(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps) {
Expand Down