Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Rename targetCommitAndReturnError: to targetCommitWithError:
  • Loading branch information
sagmor committed Apr 13, 2015
commit 647068ece7541a39d51f07c6ee2a5a51621984f6
5 changes: 4 additions & 1 deletion ObjectiveGit/GTBranch.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error(out) - will be filled if an error occurs
///
/// returns a GTCommit object or nil if an error occurred
- (nullable GTCommit *)targetCommitAndReturnError:(NSError **)error;
- (nullable GTCommit *)targetCommitWithError:(NSError **)error;

/// Count all commits in this branch
///
Expand Down Expand Up @@ -130,6 +130,9 @@ NS_ASSUME_NONNULL_BEGIN
/// Returns whether the calculation was successful.
- (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind relativeTo:(GTBranch *)branch error:(NSError **)error;

#pragma mark Deprecations
- (nullable GTCommit *)targetCommitAndReturnError:(NSError **)error __deprecated_msg("use targetCommitWithError: instead.");

@end

NS_ASSUME_NONNULL_END
7 changes: 6 additions & 1 deletion ObjectiveGit/GTBranch.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ - (NSString *)remoteName {
return [[NSString alloc] initWithBytes:name length:end - name encoding:NSUTF8StringEncoding];
}

- (GTCommit *)targetCommitAndReturnError:(NSError **)error {
- (GTCommit *)targetCommitWithError:(NSError **)error {
if (self.OID == nil) {
if (error != NULL) *error = GTReference.invalidReferenceError;
return nil;
Expand Down Expand Up @@ -218,4 +218,9 @@ - (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind relativeTo:(GTBra
return [self.repository calculateAhead:ahead behind:behind ofOID:self.OID relativeToOID:branch.OID error:error];
}

#pragma mark Deprecations
- (GTCommit *)targetCommitAndReturnError:(NSError **)error {
return [self targetCommitWithError:error];
}

@end
6 changes: 3 additions & 3 deletions ObjectiveGitTests/GTBranchSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@
it(@"should reload the branch from disk", ^{
static NSString * const originalSHA = @"a4bca6b67a5483169963572ee3da563da33712f7";
static NSString * const updatedSHA = @"6b0c1c8b8816416089c534e474f4c692a76ac14f";
expect([masterBranch targetCommitAndReturnError:NULL].SHA).to(equal(originalSHA));
expect([masterBranch targetCommitWithError:NULL].SHA).to(equal(originalSHA));
[masterBranch.reference referenceByUpdatingTarget:updatedSHA message:nil error:NULL];

GTBranch *reloadedBranch = [masterBranch reloadedBranchWithError:NULL];
expect(reloadedBranch).notTo(beNil());
expect([reloadedBranch targetCommitAndReturnError:NULL].SHA).to(equal(updatedSHA));
expect([masterBranch targetCommitAndReturnError:NULL].SHA).to(equal(originalSHA));
expect([reloadedBranch targetCommitWithError:NULL].SHA).to(equal(updatedSHA));
expect([masterBranch targetCommitWithError:NULL].SHA).to(equal(originalSHA));
});
});

Expand Down
4 changes: 2 additions & 2 deletions ObjectiveGitTests/GTIndexSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
it(@"should write to a specific repository and return a tree", ^{
GTRepository *repository = self.bareFixtureRepository;
NSArray *branches = [repository branches:NULL];
GTCommit *masterCommit = [branches[0] targetCommitAndReturnError:NULL];
GTCommit *packedCommit = [branches[1] targetCommitAndReturnError:NULL];
GTCommit *masterCommit = [branches[0] targetCommitWithError:NULL];
GTCommit *packedCommit = [branches[1] targetCommitWithError:NULL];

expect(masterCommit).notTo(beNil());
expect(packedCommit).notTo(beNil());
Expand Down