Skip to content

Commit 5d41f4e

Browse files
committed
API updates.
1 parent cb3896a commit 5d41f4e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Classes/GTRepository.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,8 @@ - (GTIndex *)indexWithError:(NSError **)error {
609609
static int submoduleEnumerationCallback(git_submodule *git_submodule, const char *name, void *payload) {
610610
GTRepositorySubmoduleEnumerationInfo *info = payload;
611611

612-
GTSubmodule *submodule = [[GTSubmodule alloc] initWithGitSubmodule:git_submodule parentRepository:info->parentRepository];
612+
// Use -submoduleWithName:error: so that we get a git_submodule that we own.
613+
GTSubmodule *submodule = [info->parentRepository submoduleWithName:@(name) error:NULL];
613614

614615
BOOL stop = NO;
615616
info->block(submodule, &stop);
@@ -623,7 +624,7 @@ static int submoduleEnumerationCallback(git_submodule *git_submodule, const char
623624
}
624625

625626
- (BOOL)reloadSubmodules:(NSError **)error {
626-
int gitError = git_submodule_reload_all(self.git_repository);
627+
int gitError = git_submodule_reload_all(self.git_repository, 0);
627628
if (gitError != GIT_OK) {
628629
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to reload submodules."];
629630
return NO;

Classes/GTSubmodule.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ - (NSString *)URLString {
7171

7272
#pragma mark Lifecycle
7373

74+
- (void)dealloc {
75+
if (_git_submodule != NULL) {
76+
git_submodule_free(_git_submodule);
77+
}
78+
}
79+
7480
- (id)initWithGitSubmodule:(git_submodule *)submodule parentRepository:(GTRepository *)repository {
7581
NSParameterAssert(submodule != NULL);
7682
NSParameterAssert(repository != nil);
@@ -100,7 +106,7 @@ - (GTSubmoduleStatus)status:(NSError **)error {
100106
#pragma mark Manipulation
101107

102108
- (BOOL)reload:(NSError **)error {
103-
int gitError = git_submodule_reload(self.git_submodule);
109+
int gitError = git_submodule_reload(self.git_submodule, 0);
104110
if (gitError != GIT_OK) {
105111
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to reload submodule %@.", self.name];
106112
return NO;

0 commit comments

Comments
 (0)