@@ -124,19 +124,23 @@ - (NSString *)remoteName {
124
124
}
125
125
126
126
- (GTCommit *)targetCommitWithError : (NSError **)error {
127
- if (self.OID == nil ) {
127
+ GTOID *oid = self.OID ;
128
+ if (oid == nil ) {
128
129
if (error != NULL ) *error = GTReference.invalidReferenceError ;
129
130
return nil ;
130
131
}
131
132
132
- return [self .repository lookUpObjectByOID: self .OID objectType: GTObjectTypeCommit error: error];
133
+ return [self .repository lookUpObjectByOID: oid objectType: GTObjectTypeCommit error: error];
133
134
}
134
135
135
136
- (NSUInteger )numberOfCommitsWithError : (NSError **)error {
136
137
GTEnumerator *enumerator = [[GTEnumerator alloc ] initWithRepository: self .repository error: error];
137
138
if (enumerator == nil ) return NSNotFound ;
138
139
139
- if (![enumerator pushSHA: self .OID.SHA error: error]) return NSNotFound ;
140
+ GTOID *oid = self.OID ;
141
+ if (oid == nil ) return NSNotFound ;
142
+
143
+ if (![enumerator pushSHA: oid.SHA error: error]) return NSNotFound ;
140
144
return [enumerator countRemainingObjects: error];
141
145
}
142
146
@@ -157,7 +161,9 @@ - (BOOL)isHEAD {
157
161
}
158
162
159
163
- (NSArray *)uniqueCommitsRelativeToBranch : (GTBranch *)otherBranch error : (NSError **)error {
160
- GTEnumerator *enumerator = [self .repository enumeratorForUniqueCommitsFromOID: self .OID relativeToOID: otherBranch.OID error: error];
164
+ GTOID *oid = self.OID ;
165
+ GTOID *otherOID = otherBranch.OID ;
166
+ GTEnumerator *enumerator = [self .repository enumeratorForUniqueCommitsFromOID: oid relativeToOID: otherOID error: error];
161
167
return [enumerator allObjectsWithError: error];
162
168
}
163
169
@@ -253,7 +259,9 @@ - (GTBranch *)reloadedBranchWithError:(NSError **)error {
253
259
}
254
260
255
261
- (BOOL )calculateAhead : (size_t *)ahead behind : (size_t *)behind relativeTo : (GTBranch *)branch error : (NSError **)error {
256
- return [self .repository calculateAhead: ahead behind: behind ofOID: self .OID relativeToOID: branch.OID error: error];
262
+ GTOID *oid = self.OID ;
263
+ GTOID *branchOID = branch.OID ;
264
+ return [self .repository calculateAhead: ahead behind: behind ofOID: oid relativeToOID: branchOID error: error];
257
265
}
258
266
259
267
@end
0 commit comments