Skip to content

Commit 647068e

Browse files
committed
Rename targetCommitAndReturnError: to targetCommitWithError:
1 parent ce160d1 commit 647068e

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

ObjectiveGit/GTBranch.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
7575
/// error(out) - will be filled if an error occurs
7676
///
7777
/// returns a GTCommit object or nil if an error occurred
78-
- (nullable GTCommit *)targetCommitAndReturnError:(NSError **)error;
78+
- (nullable GTCommit *)targetCommitWithError:(NSError **)error;
7979

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

133+
#pragma mark Deprecations
134+
- (nullable GTCommit *)targetCommitAndReturnError:(NSError **)error __deprecated_msg("use targetCommitWithError: instead.");
135+
133136
@end
134137

135138
NS_ASSUME_NONNULL_END

ObjectiveGit/GTBranch.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ - (NSString *)remoteName {
120120
return [[NSString alloc] initWithBytes:name length:end - name encoding:NSUTF8StringEncoding];
121121
}
122122

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

221+
#pragma mark Deprecations
222+
- (GTCommit *)targetCommitAndReturnError:(NSError **)error {
223+
return [self targetCommitWithError:error];
224+
}
225+
221226
@end

ObjectiveGitTests/GTBranchSpec.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@
121121
it(@"should reload the branch from disk", ^{
122122
static NSString * const originalSHA = @"a4bca6b67a5483169963572ee3da563da33712f7";
123123
static NSString * const updatedSHA = @"6b0c1c8b8816416089c534e474f4c692a76ac14f";
124-
expect([masterBranch targetCommitAndReturnError:NULL].SHA).to(equal(originalSHA));
124+
expect([masterBranch targetCommitWithError:NULL].SHA).to(equal(originalSHA));
125125
[masterBranch.reference referenceByUpdatingTarget:updatedSHA message:nil error:NULL];
126126

127127
GTBranch *reloadedBranch = [masterBranch reloadedBranchWithError:NULL];
128128
expect(reloadedBranch).notTo(beNil());
129-
expect([reloadedBranch targetCommitAndReturnError:NULL].SHA).to(equal(updatedSHA));
130-
expect([masterBranch targetCommitAndReturnError:NULL].SHA).to(equal(originalSHA));
129+
expect([reloadedBranch targetCommitWithError:NULL].SHA).to(equal(updatedSHA));
130+
expect([masterBranch targetCommitWithError:NULL].SHA).to(equal(originalSHA));
131131
});
132132
});
133133

ObjectiveGitTests/GTIndexSpec.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
it(@"should write to a specific repository and return a tree", ^{
5454
GTRepository *repository = self.bareFixtureRepository;
5555
NSArray *branches = [repository branches:NULL];
56-
GTCommit *masterCommit = [branches[0] targetCommitAndReturnError:NULL];
57-
GTCommit *packedCommit = [branches[1] targetCommitAndReturnError:NULL];
56+
GTCommit *masterCommit = [branches[0] targetCommitWithError:NULL];
57+
GTCommit *packedCommit = [branches[1] targetCommitWithError:NULL];
5858

5959
expect(masterCommit).notTo(beNil());
6060
expect(packedCommit).notTo(beNil());

0 commit comments

Comments
 (0)