Skip to content

Commit deca60d

Browse files
author
Ben Chatelain
committed
Have some style
1 parent 5dc1415 commit deca60d

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

ObjectiveGit/GTRepository+RemoteOperations.m

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,13 @@ - (NSArray *)fetchHeadEntriesWithError:(NSError **)error {
169169

170170
#pragma mark - Push (Public)
171171

172-
- (BOOL)pushBranch:(GTBranch *)branch toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock
173-
{
174-
return [self pushBranches:@[branch] toRemote:remote withOptions:options error:error progress:progressBlock];
172+
- (BOOL)pushBranch:(GTBranch *)branch toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock {
173+
return [self pushBranches:@[ branch ] toRemote:remote withOptions:options error:error progress:progressBlock];
175174
}
176175

177-
- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock
178-
{
176+
- (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock {
179177
NSMutableArray *refspecs = nil;
180-
if (branches != nil && branches.count != 0) {
178+
if (branches.count != 0) {
181179
// Build refspecs for the passed in branches
182180
refspecs = [NSMutableArray arrayWithCapacity:branches.count];
183181
for (GTBranch *branch in branches) {
@@ -191,8 +189,7 @@ - (BOOL)pushBranches:(NSArray *)branches toRemote:(GTRemote *)remote withOptions
191189

192190
#pragma mark - Push (Private)
193191

194-
- (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock
195-
{
192+
- (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error:(NSError **)error progress:(GTRemotePushTransferProgressBlock)progressBlock {
196193
int gitError;
197194
GTCredentialProvider *credProvider = options[GTRepositoryRemoteOptionsCredentialProvider];
198195

@@ -229,8 +226,7 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions
229226
git_push *push;
230227
gitError = git_push_new(&push, remote.git_remote);
231228
if (gitError != GIT_OK) {
232-
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Push object creation failed"
233-
failureReason:@"Failed to create push object for remote \"%@\"", self];
229+
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Push object creation failed" failureReason:@"Failed to create push object for remote \"%@\"", self];
234230
return NO;
235231
}
236232
@onExit {
@@ -259,8 +255,7 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions
259255
for (NSString *refspec in refspecs) {
260256
gitError = git_push_add_refspec(push, refspec.UTF8String);
261257
if (gitError != GIT_OK) {
262-
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Adding reference failed"
263-
failureReason:@"Failed to add refspec \"%@\" to push object", refspec];
258+
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Adding reference failed" failureReason:@"Failed to add refspec \"%@\" to push object", refspec];
264259
return NO;
265260
}
266261
}
@@ -273,8 +268,7 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions
273268

274269
int unpackSuccessful = git_push_unpack_ok(push);
275270
if (unpackSuccessful == 0) {
276-
if (error != NULL) *error = [NSError errorWithDomain:GTGitErrorDomain code:GIT_ERROR
277-
userInfo:@{ NSLocalizedDescriptionKey: @"Unpacking failed" }];
271+
if (error != NULL) *error = [NSError errorWithDomain:GTGitErrorDomain code:GIT_ERROR userInfo:@{ NSLocalizedDescriptionKey: @"Unpacking failed" }];
278272
return NO;
279273
}
280274

0 commit comments

Comments
 (0)