Skip to content

Commit a92eb89

Browse files
committed
Source format
1 parent 2097a10 commit a92eb89

15 files changed

Lines changed: 68 additions & 74 deletions

GitUp/Application/AppDelegate.m

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ + (void)initialize {
110110
// Without this line, GitUp would instead immediately exit, with no crash log.
111111
// libgit2 has what looks like a built-in solution (`disable_signals()`), but it doesn't seem to work for us.
112112
signal(SIGPIPE, SIG_IGN);
113-
113+
114114
NSDictionary* defaults = @{
115115
GICommitMessageViewUserDefaultKey_ShowInvisibleCharacters : @(YES),
116116
GICommitMessageViewUserDefaultKey_ShowMargins : @(YES),
@@ -178,20 +178,20 @@ - (void)handleDocumentCountChanged {
178178
}
179179

180180
- (void)_showNotificationWithTitle:(NSString*)title action:(SEL)action message:(NSString*)format, ... NS_FORMAT_FUNCTION(3, 4) {
181-
va_list arguments;
182-
va_start(arguments, format);
183-
NSString *string = [[NSString alloc] initWithFormat:format arguments:arguments];
184-
va_end(arguments);
185-
186-
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
187-
content.title = title;
188-
content.body = string;
189-
if (action) {
190-
content.userInfo = @{kNotificationUserInfoKey_Action : NSStringFromSelector(action)};
191-
}
181+
va_list arguments;
182+
va_start(arguments, format);
183+
NSString* string = [[NSString alloc] initWithFormat:format arguments:arguments];
184+
va_end(arguments);
185+
186+
UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init];
187+
content.title = title;
188+
content.body = string;
189+
if (action) {
190+
content.userInfo = @{kNotificationUserInfoKey_Action : NSStringFromSelector(action)};
191+
}
192192

193-
UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:[[NSUUID UUID] UUIDString] content:content trigger:nil];
194-
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request withCompletionHandler:nil];
193+
UNNotificationRequest* request = [UNNotificationRequest requestWithIdentifier:[[NSUUID UUID] UUIDString] content:content trigger:nil];
194+
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request withCompletionHandler:nil];
195195
}
196196

197197
#pragma mark - NSApplicationDelegate
@@ -219,15 +219,15 @@ - (void)applicationDidFinishLaunching:(NSNotification*)notification {
219219
[GILaunchServicesLocator setup];
220220

221221
// Initialize user notification center
222-
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
222+
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
223223
[center setDelegate:self];
224-
224+
225225
[center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge)
226-
completionHandler:^(BOOL granted, NSError * _Nullable error) {
227-
if (!granted) {
228-
XLOG_INFO(@"User denied notification permissions");
229-
}
230-
}];
226+
completionHandler:^(BOOL granted, NSError* _Nullable error) {
227+
if (!granted) {
228+
XLOG_INFO(@"User denied notification permissions");
229+
}
230+
}];
231231

232232
// Register finder context menu services.
233233
[NSApplication sharedApplication].servicesProvider = [ServicesProvider new];
@@ -575,8 +575,8 @@ - (void)updater:(SUUpdater*)updater willInstallUpdateOnQuit:(SUAppcastItem*)item
575575

576576
#pragma mark - UNUserNotificationCenterDelegate
577577

578-
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
579-
NSString *action = response.notification.request.content.userInfo[kNotificationUserInfoKey_Action];
578+
- (void)userNotificationCenter:(UNUserNotificationCenter*)center didReceiveNotificationResponse:(UNNotificationResponse*)response withCompletionHandler:(void (^)(void))completionHandler {
579+
NSString* action = response.notification.request.content.userInfo[kNotificationUserInfoKey_Action];
580580
if (action) {
581581
[NSApp sendAction:NSSelectorFromString(action) to:self from:nil];
582582
}

GitUp/Application/Document.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,9 @@ - (void)_updateStatusBar {
746746
// NSToolbar automatic validation fires very often and at unpredictable times so we just do everything by hand
747747
- (void)_updateToolBar {
748748
[_mainWindow.toolbar validateVisibleItems];
749-
750-
NSSegmentedControl *segmentedControl = self.modeAndNavigationSegmentedControl;
751-
NSString *windowMode = self.windowMode;
749+
750+
NSSegmentedControl* segmentedControl = self.modeAndNavigationSegmentedControl;
751+
NSString* windowMode = self.windowMode;
752752
WindowModeID windowModeID = _WindowModeIDFromString(windowMode);
753753
if (_WindowModeIsPrimary(windowMode)) {
754754
[segmentedControl setImage:[NSImage imageNamed:@"circle.2.line.diagonal"] forSegment:kWindowModeID_Map];
@@ -761,20 +761,20 @@ - (void)_updateToolBar {
761761
[segmentedControl setSelectedSegment:windowModeID];
762762
segmentedControl.action = @selector(switchMode:);
763763
} else {
764-
[segmentedControl setImage:[NSImage imageWithSystemSymbolName:@"arrow.down.forward.and.arrow.up.backward" accessibilityDescription: nil] forSegment:kNavigationAction_Exit];
764+
[segmentedControl setImage:[NSImage imageWithSystemSymbolName:@"arrow.down.forward.and.arrow.up.backward" accessibilityDescription:nil] forSegment:kNavigationAction_Exit];
765765
[segmentedControl setImage:[NSImage imageWithSystemSymbolName:@"chevron.up" accessibilityDescription:nil] forSegment:kNavigationAction_Next];
766766
[segmentedControl setImage:[NSImage imageWithSystemSymbolName:@"chevron.down" accessibilityDescription:nil] forSegment:kNavigationAction_Previous];
767767
segmentedControl.trackingMode = NSSegmentSwitchTrackingMomentary;
768768
segmentedControl.action = @selector(navigate:);
769769
}
770770
}
771771

772-
- (NSSegmentedControl *)modeAndNavigationSegmentedControl {
773-
return (NSSegmentedControl *)self.navigateItem.primaryControl;
772+
- (NSSegmentedControl*)modeAndNavigationSegmentedControl {
773+
return (NSSegmentedControl*)self.navigateItem.primaryControl;
774774
}
775775

776776
- (void)_didBecomeActive:(NSNotification*)notification {
777-
/**
777+
/**
778778
async dispatch on the main queue so we don't block
779779
NSApplicationDidBecomeActiveNotification while updating the repos
780780
*/

GitUpKit/Components/GIDiffContentsViewController.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ - (NSView*)tableView:(NSTableView*)tableView viewForTableColumn:(NSTableColumn*)
551551
break;
552552
}
553553
if (data.conflict.ancestorFileMode == kGCFileMode_Commit) {
554-
// Submodule conflict
554+
//  Submodule conflict
555555
GISubmoduleConflictDiffCellView* view = [_tableView makeViewWithIdentifier:@"submodule_conflict" owner:self];
556556
view.statusTextField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"This submodule has conflicts (%@)", nil), status];
557557
view.oursTextField.stringValue = data.conflict.ourBlobSHA1;
@@ -758,7 +758,7 @@ - (IBAction)markAsResolved:(id)sender {
758758

759759
- (IBAction)chooseOurs:(id)sender {
760760
GIDiffContentData* data = (__bridge GIDiffContentData*)(void*)[(NSButton*)sender tag];
761-
NSError *error;
761+
NSError* error;
762762

763763
[self.repository updateSubmoduleReferenceAtPath:data.conflict.path toCommitSHA1:data.conflict.ourBlobSHA1 error:&error];
764764

@@ -773,8 +773,7 @@ - (IBAction)chooseOurs:(id)sender {
773773

774774
- (IBAction)chooseTheirs:(id)sender {
775775
GIDiffContentData* data = (__bridge GIDiffContentData*)(void*)[(NSButton*)sender tag];
776-
NSError *error;
777-
776+
NSError* error;
778777

779778
[self.repository updateSubmoduleReferenceAtPath:data.conflict.path toCommitSHA1:data.conflict.theirBlobSHA1 error:&error];
780779

GitUpKit/Core/GCDiff.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,22 +358,22 @@ - (void)_cacheDeltasIfNeeded {
358358
// Remove superfluous "untracked" deltas for conflicting submodules
359359
// Needed when the input _deltas looks like this:
360360
// 1: [Conflicted] "submodule"
361-
// 2: [Untracked] "submodule/"
361+
//  2: [Untracked] "submodule/"
362362
// Which happens every time there's a submodule entry that's a conflict
363-
NSMutableArray<GCDiffDelta *> *deltasToFilterOut = [NSMutableArray array];
363+
NSMutableArray<GCDiffDelta*>* deltasToFilterOut = [NSMutableArray array];
364364
for (GCDiffDelta* delta in _deltas) {
365365
if (delta.change == kGCFileDiffChange_Conflicted && delta.isSubmodule) {
366-
// see if there's a superfluous untracked diff for that submodule and remove it
367-
NSString *pathWithTrailingSlash = [NSString stringWithFormat:@"%@/", delta.canonicalPath];
366+
//  see if there's a superfluous untracked diff for that submodule and remove it
367+
NSString* pathWithTrailingSlash = [NSString stringWithFormat:@"%@/", delta.canonicalPath];
368368
for (GCDiffDelta* delta in _deltas) {
369369
if (delta.isSubmodule && [delta.canonicalPath isEqualToString:pathWithTrailingSlash]) {
370370
[deltasToFilterOut addObject:delta];
371-
break; // there's only one so we can break out early if we've found it
371+
break; //  there's only one so we can break out early if we've found it
372372
}
373373
}
374374
}
375375
}
376-
376+
377377
[_deltas removeObjectsInArray:deltasToFilterOut];
378378
}
379379
}

GitUpKit/Core/GCHistory.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,7 @@ - (BOOL)iterateWithCommitBlock:(void (^)(GCHistoryCommit* commit, BOOL* stop))bl
459459
// Keep generating commit rows following parents (respectively children)
460460
if (GC_POINTER_LIST_COUNT(previousRow)) {
461461
__block BOOL success = NO;
462-
BOOL(^commitBlock)
463-
(GCHistoryCommit*) = ^(GCHistoryCommit* commit) {
462+
BOOL (^commitBlock)(GCHistoryCommit*) = ^(GCHistoryCommit* commit) {
464463
XLOG_DEBUG_CHECK(!COMMIT_IS_PROCESSED(commit));
465464
BOOL ready = YES;
466465

@@ -775,8 +774,7 @@ - (BOOL)_reloadHistory:(GCHistory*)history
775774
}
776775

777776
// Find all other tips
778-
BOOL(^enumerateBlock)
779-
(git_reference*) = ^(git_reference* reference) {
777+
BOOL (^enumerateBlock)(git_reference*) = ^(git_reference* reference) {
780778
GCReference* referenceObject = nil;
781779
if (git_reference_type(reference) != GIT_REF_SYMBOLIC) { // Skip symbolic refs like "remote/origin/HEAD"
782780
git_commit* commit = NULL;
@@ -901,7 +899,7 @@ - (BOOL)_reloadHistory:(GCHistory*)history
901899
// Configure commit tree walker to start from tips
902900
CALL_LIBGIT2_FUNCTION_GOTO(cleanup, git_revwalk_new, &walker, self.private);
903901
git_revwalk_sorting(walker, GIT_SORT_NONE);
904-
git_revwalk_add_hide_block(walker, ^int(const git_oid *commit_id) {
902+
git_revwalk_add_hide_block(walker, ^int(const git_oid* commit_id) {
905903
return CFDictionaryContainsKey(lookup, commit_id);
906904
});
907905
if (historyTips) {

GitUpKit/Core/GCIndex.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ - (BOOL)_addEntry:(const git_index_entry*)entry toIndex:(git_index*)index error:
302302
}
303303

304304
// This function adapts to handle submodules by directly using the commit OID and setting the correct file mode for submodules.
305-
- (BOOL)_addSubmoduleEntry:(const git_index_entry*)entry toIndex:(git_index*)index withCommitOid:(const git_oid *)commitOid error:(NSError**)error {
305+
- (BOOL)_addSubmoduleEntry:(const git_index_entry*)entry toIndex:(git_index*)index withCommitOid:(const git_oid*)commitOid error:(NSError**)error {
306306
git_index_entry copyEntry;
307307
bcopy(entry, &copyEntry, sizeof(git_index_entry));
308308
git_oid_cpy(&copyEntry.id, commitOid);
@@ -328,17 +328,17 @@ - (BOOL)addFileInWorkingDirectory:(NSString*)path toIndex:(GCIndex*)index error:
328328
git_index_entry__init_from_stat(&entry, &info, true);
329329

330330
if (entry.mode == GIT_FILEMODE_COMMIT) {
331-
GCSubmodule *submodule = [self lookupSubmoduleWithName:path error:error];
331+
GCSubmodule* submodule = [self lookupSubmoduleWithName:path error:error];
332332
if (!submodule) {
333333
return NO;
334334
}
335335

336-
GCRepository *submoduleRepository = [[GCRepository alloc] initWithSubmodule:submodule error:error];
336+
GCRepository* submoduleRepository = [[GCRepository alloc] initWithSubmodule:submodule error:error];
337337
if (!submoduleRepository) {
338338
return NO;
339339
}
340340

341-
GCCommit *headCommit;
341+
GCCommit* headCommit;
342342
if (![submoduleRepository lookupHEADCurrentCommit:&headCommit branch:NULL error:error]) {
343343
return NO;
344344
}
@@ -536,10 +536,10 @@ - (BOOL)checkoutFileToWorkingDirectory:(NSString*)path fromIndex:(GCIndex*)index
536536
}
537537

538538
- (BOOL)checkoutFilesToWorkingDirectory:(NSArray<NSString*>*)paths fromIndex:(GCIndex*)index error:(NSError**)error {
539-
if ([paths count] == 0) {
540-
return YES;
541-
}
542-
539+
if ([paths count] == 0) {
540+
return YES;
541+
}
542+
543543
git_checkout_options options = GIT_CHECKOUT_OPTIONS_INIT;
544544
options.checkout_strategy = GIT_CHECKOUT_FORCE | GIT_CHECKOUT_DONT_UPDATE_INDEX; // There's no reason to update the index
545545
options.paths.count = paths.count;

GitUpKit/Core/GCLiveRepository+Conflicts.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ - (GCCommit*)resolveConflictsWithResolver:(id<GCMergeConflictResolver>)resolver
1919
parentCommits:(NSArray*)parentCommits
2020
message:(NSString*)message
2121
error:(NSError**)error {
22-
23-
2422
// Save HEAD
2523
GCCommit* headCommit;
2624
GCLocalBranch* headBranch;

GitUpKit/Core/GCRepository+Bare.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ - (GCCommit*)cherryPickCommit:(GCCommit*)pickCommit
9595
message:(NSString*)message
9696
conflictHandler:(GCConflictHandler)handler
9797
error:(NSError**)error {
98-
const git_commit** parents = (againstCommit != nil) ? (git_commit*[]) {againstCommit.private} : (git_commit*[]) {};
98+
const git_commit** parents = (againstCommit != nil) ? (git_commit*[]){againstCommit.private} : (git_commit*[]){};
9999
return [self _mergeTheirCommit:pickCommit.private
100100
intoOurCommit:againstCommit.private
101101
withAncestorCommit:ancestorCommit.private
@@ -113,7 +113,7 @@ - (GCCommit*)revertCommit:(GCCommit*)revertCommit
113113
message:(NSString*)message
114114
conflictHandler:(GCConflictHandler)handler
115115
error:(NSError**)error {
116-
const git_commit** parents = (againstCommit != nil) ? (git_commit*[]) {againstCommit.private} : (git_commit*[]) {};
116+
const git_commit** parents = (againstCommit != nil) ? (git_commit*[]){againstCommit.private} : (git_commit*[]){};
117117
return [self _mergeTheirCommit:ancestorCommit.private
118118
intoOurCommit:againstCommit.private
119119
withAncestorCommit:revertCommit.private

GitUpKit/Core/GCRepository+HEAD.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ typedef NS_OPTIONS(NSUInteger, GCCheckoutOptions) {
3232
- (BOOL)setDetachedHEADToCommit:(GCCommit*)commit error:(NSError**)error; // git update-ref HEAD {commit}
3333

3434
- (BOOL)moveHEADToCommit:(GCCommit*)commit reflogMessage:(NSString*)message error:(NSError**)error; // git reset --soft {commit} (but with custom reflog message)
35-
- (BOOL)updateSubmoduleReferenceAtPath:(NSString *)submodulePath toCommitSHA1:(NSString *)commitSHA1 error:(NSError **)error;
35+
- (BOOL)updateSubmoduleReferenceAtPath:(NSString*)submodulePath toCommitSHA1:(NSString*)commitSHA1 error:(NSError**)error;
3636

3737
- (BOOL)checkoutCommit:(GCCommit*)commit options:(GCCheckoutOptions)options error:(NSError**)error; // git checkout {commit}
3838
- (BOOL)checkoutLocalBranch:(GCLocalBranch*)branch options:(GCCheckoutOptions)options error:(NSError**)error; // git checkout {branch}

GitUpKit/Core/GCRepository+HEAD.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,17 @@ - (BOOL)checkoutCommit:(GCCommit*)commit options:(GCCheckoutOptions)options erro
222222
}
223223

224224
- (BOOL)updateSubmoduleReferenceAtPath:(NSString*)submodulePath toCommitSHA1:(NSString*)commitSHA1 error:(NSError**)error {
225-
GCSubmodule *submodule = [self lookupSubmoduleWithName:submodulePath error:error];
225+
GCSubmodule* submodule = [self lookupSubmoduleWithName:submodulePath error:error];
226226
if (!submodule) {
227227
return NO;
228228
}
229229

230-
GCRepository *submoduleRepository = [[GCRepository alloc] initWithSubmodule:submodule error:error];
230+
GCRepository* submoduleRepository = [[GCRepository alloc] initWithSubmodule:submodule error:error];
231231
if (!submoduleRepository) {
232232
return NO;
233233
}
234234

235-
GCCommit *targetCommit = [submoduleRepository findCommitWithSHA1:commitSHA1 error:error];
235+
GCCommit* targetCommit = [submoduleRepository findCommitWithSHA1:commitSHA1 error:error];
236236
if (!targetCommit) {
237237
return NO;
238238
}

0 commit comments

Comments
 (0)