-
Notifications
You must be signed in to change notification settings - Fork 281
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
Fetch support. #224
Conversation
which is waiting for merging in libgit2/libgit2#1729
@@ -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]]; |
There was a problem hiding this comment.
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.
🍄 Can you please also merge from |
🌻 |
|
||
- (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; |
There was a problem hiding this comment.
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 tocredentialBlock
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
I'll work on a few of these comments and commit. |
… instance variable access.
@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). |
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]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can use -mutableCopy
.
There was a problem hiding this comment.
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 😧.
This looks really great. Thanks, and sorry for the delay! 🙇 |
Fetch support.
This supersedes #203.
It looks mostly ready so I'm open to suggestions. It misses tests (again :-S) and documentation.