Skip to content
Merged
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
13 changes: 12 additions & 1 deletion Classes/GTRepository+RemoteOperations.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,18 @@ - (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error
return NO;
}

gitError = git_remote_fetch(remote.git_remote, self.userSignatureForNow.git_signature, NULL);
__block git_strarray refspecs;
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 think this __block is necessary, since it'll only be captured in @onExit after receiving a value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Compiler says no. Looks like it captures a const reference in the block. Although I could cast that error away, but at that point I'd prefer to use the __block qualifier.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, right. 👍

gitError = git_remote_get_fetch_refspecs(&refspecs, remote.git_remote);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to get fetch refspecs for remote"];
return NO;
}

@onExit {
git_strarray_free(&refspecs);
};

gitError = git_remote_fetch(remote.git_remote, &refspecs, self.userSignatureForNow.git_signature, NULL);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to fetch from remote"];
return NO;
Expand Down
3 changes: 2 additions & 1 deletion Classes/GTRepository+Reset.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ @implementation GTRepository (Reset)
- (BOOL)resetToCommit:(GTCommit *)commit resetType:(GTRepositoryResetType)resetType error:(NSError **)error {
NSParameterAssert(commit != nil);

int gitError = git_reset(self.git_repository, commit.git_object, (git_reset_t)resetType, (git_signature *)[self userSignatureForNow].git_signature, NULL);
git_checkout_options options = GIT_CHECKOUT_OPTIONS_INIT;
int gitError = git_reset(self.git_repository, commit.git_object, (git_reset_t)resetType, &options, (git_signature *)[self userSignatureForNow].git_signature, NULL);
if (gitError != GIT_OK) {
if (error != NULL) {
*error = [NSError git_errorFor:gitError description:@"Failed to reset repository to commit %@.", commit.SHA];
Expand Down
2 changes: 1 addition & 1 deletion External/libgit2
Submodule libgit2 updated 181 files