From fc9e3a8b30a512c8d4149b45df48b0fddbea00d5 Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Wed, 15 Oct 2014 16:27:23 +1100 Subject: [PATCH 01/10] Refresh git configuration before looking for the tracking branch. --- Classes/GTBranch.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Classes/GTBranch.m b/Classes/GTBranch.m index d6b9617b6..0fcf65871 100644 --- a/Classes/GTBranch.m +++ b/Classes/GTBranch.m @@ -27,6 +27,7 @@ #import "GTReference.h" #import "GTEnumerator.h" #import "GTRepository.h" +#import "GTConfiguration.h" #import "GTCommit.h" #import "GTRemote.h" #import "NSError+Git.h" @@ -175,6 +176,19 @@ - (GTBranch *)trackingBranchWithError:(NSError **)error success:(BOOL *)success return self; } + // Refresh configuration first so that libgit2 gets any updated tracking + // refs in the repository's config. + GTConfiguration *configuration = [self.repository configurationWithError:error]; + if (configuration == nil) { + if (success != NULL) *success = NO; + return nil; + } + + if (![configuration refresh:error]) { + if (success != NULL) *success = NO; + return nil; + } + git_reference *trackingRef = NULL; int gitError = git_branch_upstream(&trackingRef, self.reference.git_reference); From e091fa7958d69480c7124131aeb9dca1749ffcc7 Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Thu, 16 Oct 2014 12:50:32 +1100 Subject: [PATCH 02/10] Revert "Refresh git configuration before looking for the tracking branch." This reverts commit fc9e3a8b30a512c8d4149b45df48b0fddbea00d5. --- Classes/GTBranch.m | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Classes/GTBranch.m b/Classes/GTBranch.m index 0fcf65871..d6b9617b6 100644 --- a/Classes/GTBranch.m +++ b/Classes/GTBranch.m @@ -27,7 +27,6 @@ #import "GTReference.h" #import "GTEnumerator.h" #import "GTRepository.h" -#import "GTConfiguration.h" #import "GTCommit.h" #import "GTRemote.h" #import "NSError+Git.h" @@ -176,19 +175,6 @@ - (GTBranch *)trackingBranchWithError:(NSError **)error success:(BOOL *)success return self; } - // Refresh configuration first so that libgit2 gets any updated tracking - // refs in the repository's config. - GTConfiguration *configuration = [self.repository configurationWithError:error]; - if (configuration == nil) { - if (success != NULL) *success = NO; - return nil; - } - - if (![configuration refresh:error]) { - if (success != NULL) *success = NO; - return nil; - } - git_reference *trackingRef = NULL; int gitError = git_branch_upstream(&trackingRef, self.reference.git_reference); From 09c68b587626c836b42397ca0402a14479dc4ce6 Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Thu, 16 Oct 2014 15:57:33 +1100 Subject: [PATCH 03/10] ++libgit2 --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 2cd3cb8e0..3bcf260d8 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 2cd3cb8e03591e08c1cc1890ae5b82a498773f19 +Subproject commit 3bcf260d82f787f1f4b6f4ea0a0814d64948ae7c From c05c663646777e9c675f68dd56cc0b06e59ed126 Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Thu, 16 Oct 2014 15:57:49 +1100 Subject: [PATCH 04/10] Update calls for libgit2 interface changes. --- Classes/GTRepository+RemoteOperations.m | 2 +- Classes/GTRepository+Reset.m | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/GTRepository+RemoteOperations.m b/Classes/GTRepository+RemoteOperations.m index dcf096811..5d73eb56d 100644 --- a/Classes/GTRepository+RemoteOperations.m +++ b/Classes/GTRepository+RemoteOperations.m @@ -62,7 +62,7 @@ - (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error return NO; } - gitError = git_remote_fetch(remote.git_remote, self.userSignatureForNow.git_signature, NULL); + gitError = git_remote_fetch(remote.git_remote, NULL, 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; diff --git a/Classes/GTRepository+Reset.m b/Classes/GTRepository+Reset.m index 7481a325a..1ab853518 100644 --- a/Classes/GTRepository+Reset.m +++ b/Classes/GTRepository+Reset.m @@ -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]; From 3d7f17b958f846dccd52d4d0b8aa0940d42cc117 Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Thu, 16 Oct 2014 16:07:51 +1100 Subject: [PATCH 05/10] ++libgit2 --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 3bcf260d8..a68ddfa9f 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 3bcf260d82f787f1f4b6f4ea0a0814d64948ae7c +Subproject commit a68ddfa9fbdedb401a38485d111cd7483d611d14 From 0532962ac9c13c9ed466a8eadfca87837f0397cc Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Fri, 17 Oct 2014 15:10:53 +1100 Subject: [PATCH 06/10] ++libgit2 for new PR. --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index a68ddfa9f..48875d4a3 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit a68ddfa9fbdedb401a38485d111cd7483d611d14 +Subproject commit 48875d4a326bc990c5b3cceabaa9c5013899593e From df69dce1d737ee122908b43f520618144876db0e Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Tue, 21 Oct 2014 09:56:39 +1100 Subject: [PATCH 07/10] ++libgit2 --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 48875d4a3..6e02325fc 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 48875d4a326bc990c5b3cceabaa9c5013899593e +Subproject commit 6e02325fc10ef0c5b79604f8ebd94cfec5f9b84d From 38fc5e8ff105716aa87fe58cf9db57d43cd64d65 Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Tue, 21 Oct 2014 10:38:39 +1100 Subject: [PATCH 08/10] Get the fetch ref specs and pass them to get_remote_fetch. --- Classes/GTRepository+RemoteOperations.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Classes/GTRepository+RemoteOperations.m b/Classes/GTRepository+RemoteOperations.m index 5d73eb56d..26f338e79 100644 --- a/Classes/GTRepository+RemoteOperations.m +++ b/Classes/GTRepository+RemoteOperations.m @@ -62,7 +62,18 @@ - (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error return NO; } - gitError = git_remote_fetch(remote.git_remote, NULL, self.userSignatureForNow.git_signature, NULL); + __block git_strarray refspecs; + 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; From b61a3a9257b033b6d627688a0c88e01e1e767a04 Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Thu, 23 Oct 2014 14:37:18 +1100 Subject: [PATCH 09/10] ++libgit2 --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index 6e02325fc..a7b2cd425 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 6e02325fc10ef0c5b79604f8ebd94cfec5f9b84d +Subproject commit a7b2cd4257d921b5b81991bf7982716f4711ab3d From 9bd9d5c22115cee8d4b735bf420ead53f6f67764 Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Fri, 24 Oct 2014 08:28:59 +1100 Subject: [PATCH 10/10] bump libgit2 to master --- External/libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/libgit2 b/External/libgit2 index a7b2cd425..4bb6ffb6b 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit a7b2cd4257d921b5b81991bf7982716f4711ab3d +Subproject commit 4bb6ffb6bb8ad9d49eb173350be965183cd09c96