Skip to content

Fetch support. #224

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

Merged
merged 163 commits into from
Sep 11, 2014
Merged

Fetch support. #224

merged 163 commits into from
Sep 11, 2014

Conversation

tiennou
Copy link
Contributor

@tiennou tiennou commented Jul 15, 2013

This supersedes #203.

It looks mostly ready so I'm open to suggestions. It misses tests (again :-S) and documentation.

@jspahrsummers jspahrsummers mentioned this pull request Jul 15, 2013
@ghost ghost assigned jspahrsummers Jul 15, 2013
@@ -127,6 +128,10 @@ - (NSString *)remoteName {
return [[NSString alloc] initWithBytes:name length:end - name encoding:NSUTF8StringEncoding];
}

- (GTRemote *)remote {
return [GTRemote remoteWithName:[self remoteName] inRepository:[self repository]];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: dot syntax, since these methods don't have externally-visible side effects.

@jspahrsummers
Copy link
Contributor

🍄 Can you please also merge from master?

@tiennou
Copy link
Contributor Author

tiennou commented Jul 16, 2013

🌻


- (id)initWithGitRemote:(git_remote *)remote;

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

- (BOOL)fetchWithError:(NSError **)error credentials:(int (^)(git_cred **cred, GTCredentialType allowedTypes, NSString *url, NSString *username))credBlock progress:(void (^)(NSString *message, int length))progressBlock completion:(int (^)(GTRemoteCompletionType type))completionBlock updateTips:(int (^)(GTReference *ref, GTOID *a, GTOID *b))updateTipsBlock;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the name isn't right. What about -cancelOperation ? I'm not really against *stop parameters, but the caller of the block ought to still have access to the specific remote under consideration to call it, and I can't really add the *stop parameter to credentialBlock because it won't always be needed.

I don't think the credential block needs a BOOL *stop, but the rest should have one. The remote is still accessible, because any code that could pass in these blocks will also know the GTRemote object, and can just capture it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's more or less what I was saying ;-). I'll add *stop parameters then.

}

- (BOOL)updatesFetchHead {
return git_remote_update_fetchhead(self.git_remote) == 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anywhere that specifies this will return 1. We should probably compare != 0 instead.

@jspahrsummers
Copy link
Contributor

Thanks! Just a few more notes.

@pbendersky
Copy link
Contributor

I'll work on a few of these comments and commit.

@pbendersky
Copy link
Contributor

@jspahrsummers There are only two changes missing, I'm waiting on your comments on those (options dictionary, which is similar to what we currently have for clone).

@tiennou
Copy link
Contributor Author

tiennou commented Sep 4, 2014

Okay, good to go.

As a bonus, I added a remote clone test against the libgit2 documentation if you set some environment variables — I'm overly cautious around pointer-thingy changes ;-).

@@ -67,6 +67,26 @@ + (NSError *)git_errorFor:(int)code description:(NSString *)desc failureReason:(
return [NSError errorWithDomain:GTGitErrorDomain code:code userInfo:userInfo];
}

+ (NSError *)git_errorFor:(int)code description:(NSString *)desc userInfo:(NSDictionary *)additionalUserInfo failureReason:(NSString *)reason, ... {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:additionalUserInfo];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can use -mutableCopy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was so annoyed by the duplication between this and the one above that it just flew above my head 😧.

@jspahrsummers
Copy link
Contributor

This looks really great. Thanks, and sorry for the delay! 🙇

jspahrsummers added a commit that referenced this pull request Sep 11, 2014
@jspahrsummers jspahrsummers merged commit db3a254 into master Sep 11, 2014
@jspahrsummers jspahrsummers deleted the fetch branch September 11, 2014 17:15
phatblat pushed a commit to phatblat/objective-git that referenced this pull request Sep 13, 2014
@phatblat phatblat mentioned this pull request Nov 12, 2014
@jspahrsummers jspahrsummers removed their assignment May 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.