Skip to content

Commit 4f47bdc

Browse files
committed
Merge pull request #413 from libgit2/fix-tracking-branch
Refresh git configuration before looking for the tracking branch.
2 parents 8d0a5f8 + 9bd9d5c commit 4f47bdc

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Classes/GTRepository+RemoteOperations.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,18 @@ - (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error
6262
return NO;
6363
}
6464

65-
gitError = git_remote_fetch(remote.git_remote, self.userSignatureForNow.git_signature, NULL);
65+
__block git_strarray refspecs;
66+
gitError = git_remote_get_fetch_refspecs(&refspecs, remote.git_remote);
67+
if (gitError != GIT_OK) {
68+
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to get fetch refspecs for remote"];
69+
return NO;
70+
}
71+
72+
@onExit {
73+
git_strarray_free(&refspecs);
74+
};
75+
76+
gitError = git_remote_fetch(remote.git_remote, &refspecs, self.userSignatureForNow.git_signature, NULL);
6677
if (gitError != GIT_OK) {
6778
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to fetch from remote"];
6879
return NO;

Classes/GTRepository+Reset.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ @implementation GTRepository (Reset)
1717
- (BOOL)resetToCommit:(GTCommit *)commit resetType:(GTRepositoryResetType)resetType error:(NSError **)error {
1818
NSParameterAssert(commit != nil);
1919

20-
int gitError = git_reset(self.git_repository, commit.git_object, (git_reset_t)resetType, (git_signature *)[self userSignatureForNow].git_signature, NULL);
20+
git_checkout_options options = GIT_CHECKOUT_OPTIONS_INIT;
21+
int gitError = git_reset(self.git_repository, commit.git_object, (git_reset_t)resetType, &options, (git_signature *)[self userSignatureForNow].git_signature, NULL);
2122
if (gitError != GIT_OK) {
2223
if (error != NULL) {
2324
*error = [NSError git_errorFor:gitError description:@"Failed to reset repository to commit %@.", commit.SHA];

External/libgit2

Submodule libgit2 updated 181 files

0 commit comments

Comments
 (0)