Skip to content

Commit 64aa5a9

Browse files
committed
🔥 -allBranchesWithError:
Use -branches: from now on.
1 parent af86a9f commit 64aa5a9

File tree

3 files changed

+1
-28
lines changed

3 files changed

+1
-28
lines changed

ObjectiveGit/GTRepository.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,6 @@ extern NSString * const GTRepositoryInitOptionsOriginURLString;
242242

243243
- (GTReference *)headReferenceWithError:(NSError **)error;
244244

245-
/// Convenience methods to return branches in the repository
246-
- (NSArray *)allBranchesWithError:(NSError **)error;
247-
248245
- (NSArray *)localBranchesWithError:(NSError **)error;
249246
- (NSArray *)remoteBranchesWithError:(NSError **)error;
250247
- (NSArray *)branchesWithPrefix:(NSString *)prefix error:(NSError **)error;

ObjectiveGit/GTRepository.m

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -401,30 +401,6 @@ - (NSArray *)branchesWithPrefix:(NSString *)prefix error:(NSError **)error {
401401
return branches;
402402
}
403403

404-
- (NSArray *)allBranchesWithError:(NSError **)error {
405-
NSMutableArray *allBranches = [NSMutableArray array];
406-
NSArray *localBranches = [self localBranchesWithError:error];
407-
NSArray *remoteBranches = [self remoteBranchesWithError:error];
408-
if (localBranches == nil || remoteBranches == nil) return nil;
409-
410-
[allBranches addObjectsFromArray:localBranches];
411-
412-
// we want to add the remote branches that we don't already have as a local branch
413-
NSMutableDictionary *shortNamesToBranches = [NSMutableDictionary dictionary];
414-
for (GTBranch *branch in localBranches) {
415-
[shortNamesToBranches setObject:branch forKey:branch.shortName];
416-
}
417-
418-
for (GTBranch *branch in remoteBranches) {
419-
GTBranch *localBranch = [shortNamesToBranches objectForKey:branch.shortName];
420-
if (localBranch == nil) {
421-
[allBranches addObject:branch];
422-
}
423-
}
424-
425-
return allBranches;
426-
}
427-
428404
- (NSArray *)branches:(NSError **)error {
429405
NSArray *localBranches = [self localBranchesWithError:error];
430406
if (localBranches == nil) return nil;

ObjectiveGitTests/GTIndexSpec.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
it(@"should write to a specific repository and return a tree", ^{
5454
GTRepository *repository = self.bareFixtureRepository;
55-
NSArray *branches = [repository allBranchesWithError:NULL];
55+
NSArray *branches = [repository branches:NULL];
5656
GTCommit *masterCommit = [branches[0] targetCommitAndReturnError:NULL];
5757
GTCommit *packedCommit = [branches[1] targetCommitAndReturnError:NULL];
5858

0 commit comments

Comments
 (0)