Skip to content

Commit a93dd8d

Browse files
committed
Format source code before next release
1 parent 4a1bc7e commit a93dd8d

12 files changed

+60
-61
lines changed

GitUp/Application/AppDelegate.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ - (void)_openRepositoryWithURL:(NSURL*)url inTab:(BOOL)inTab withCloneMode:(Clon
147147
}
148148
[document showWindows];
149149
}
150-
150+
151151
if (documentWasAlreadyOpen) {
152152
if ((NSUInteger)windowModeID != NSNotFound) {
153153
[(Document*)document setWindowModeID:windowModeID];
@@ -353,7 +353,7 @@ - (NSDictionary*)_processToolCommand:(NSDictionary*)input {
353353

354354
#pragma mark - Actions
355355

356-
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
356+
- (BOOL)validateMenuItem:(NSMenuItem*)menuItem {
357357
if (menuItem.action == @selector(checkForUpdates:)) {
358358
return [_updater validateMenuItem:menuItem];
359359
}

GitUp/Application/PreferencesWindowController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ - (void)windowDidLoad {
8989
];
9090

9191
self.selectedItemIdentifier = PreferencesWindowController_Identifier_General;
92-
92+
9393
[self loadUserDefaults];
9494
}
9595

GitUp/Tool/main.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int main(int argc, const char* argv[]) {
6666
@autoreleasepool {
6767
const char* command = "open";
6868
const char* option = "";
69-
69+
7070
for (int i = 1; i < argc; i++) {
7171
const char* arg = argv[i];
7272
// Commands
@@ -177,14 +177,14 @@ BOOL isEqual(const char* stringA, const char* stringB) {
177177

178178
BOOL isEqualToAny(const char* string, int count, ...) {
179179
va_list ap;
180-
va_start (ap, count); /* Initialize the argument list. */
181-
180+
va_start(ap, count); /* Initialize the argument list. */
181+
182182
for (int i = 0; i < count; i++) {
183183
const char* aString = va_arg(ap, const char*);
184184
if (isEqual(string, aString)) {
185185
return YES;
186186
}
187187
}
188-
va_end (ap); /* Clean up. */
188+
va_end(ap); /* Clean up. */
189189
return NO;
190190
}

GitUpKit/Components/GIDiffContentsViewController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ - (void)_reloadDeltas {
343343

344344
CFStringRef fileExtension = (__bridge CFStringRef)delta.canonicalPath.pathExtension;
345345
CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);
346-
BOOL isImage = [NSImage.imageTypes containsObject:(__bridge NSString *)(fileUTI)];
346+
BOOL isImage = [NSImage.imageTypes containsObject:(__bridge NSString*)(fileUTI)];
347347
CFRelease(fileUTI);
348348
if (isImage) {
349349
GIImageDiffView* imageDiffView = [[GIImageDiffView alloc] initWithRepository:self.repository];

GitUpKit/Core/GCDiff.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@ typedef void (^GCDiffEndHunkHandler)(void);
7171
@end
7272

7373
/* "x" means non-nil, "-" means nil and [X] means canonical path
74-
74+
7575
Old New
7676
Unmodified [X] -
7777
Ignored [X] -
7878
Untracked [X] -
7979
Unreadable [X] -
80-
80+
8181
Added - [X]
8282
Deleted [X] -
8383
Modified x [X]
84-
84+
8585
Renamed x [X]
8686
Copied x [X]
8787
TypeChanged x [X]
88-
88+
8989
Conflicted x [X]
9090
*/
9191
@interface GCDiffDelta : NSObject

GitUpKit/Core/GCIndex.m

+8-8
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ - (BOOL)addLinesInWorkingDirectoryFile:(NSString*)path toIndex:(GCIndex*)index e
356356
[patch enumerateUsingBeginHunkHandler:NULL
357357
lineHandler:^(GCLineDiffChange change, NSUInteger oldLineNumber, NSUInteger newLineNumber, const char* contentBytes, NSUInteger contentLength) {
358358
/* Comparing workdir to index:
359-
359+
360360
Change | Filter | Write?
361361
------------|------------|------------
362362
Unmodified | - | YES
@@ -366,7 +366,7 @@ - (BOOL)addLinesInWorkingDirectoryFile:(NSString*)path toIndex:(GCIndex*)index e
366366
------------|------------|------------
367367
Deleted | YES | NO
368368
| NO | YES
369-
369+
370370
*/
371371
BOOL shouldWrite = YES;
372372
switch (change) {
@@ -452,7 +452,7 @@ - (BOOL)resetLinesInFile:(NSString*)path index:(GCIndex*)index toCommit:(GCCommi
452452
[patch enumerateUsingBeginHunkHandler:NULL
453453
lineHandler:^(GCLineDiffChange change, NSUInteger oldLineNumber, NSUInteger newLineNumber, const char* contentBytes, NSUInteger contentLength) {
454454
/* Comparing index to commit:
455-
455+
456456
Change | Filter | Write?
457457
------------|------------|------------
458458
Unmodified | - | YES
@@ -462,7 +462,7 @@ - (BOOL)resetLinesInFile:(NSString*)path index:(GCIndex*)index toCommit:(GCCommi
462462
------------|------------|------------
463463
Deleted | YES | YES
464464
| NO | NO
465-
465+
466466
*/
467467
BOOL shouldWrite = YES;
468468
switch (change) {
@@ -530,7 +530,7 @@ - (BOOL)checkoutLinesInFileToWorkingDirectory:(NSString*)path fromIndex:(GCIndex
530530
[patch enumerateUsingBeginHunkHandler:NULL
531531
lineHandler:^(GCLineDiffChange change, NSUInteger oldLineNumber, NSUInteger newLineNumber, const char* contentBytes, NSUInteger contentLength) {
532532
/* Comparing workdir to index:
533-
533+
534534
Change | Filter | Write?
535535
------------|------------|------------
536536
Unmodified | - | YES
@@ -540,7 +540,7 @@ - (BOOL)checkoutLinesInFileToWorkingDirectory:(NSString*)path fromIndex:(GCIndex
540540
------------|------------|------------
541541
Deleted | YES | YES
542542
| NO | NO
543-
543+
544544
*/
545545
BOOL shouldWrite = YES;
546546
switch (change) {
@@ -638,7 +638,7 @@ - (BOOL)copyLinesInFile:(NSString*)path fromOtherIndex:(GCIndex*)otherIndex toIn
638638
[patch enumerateUsingBeginHunkHandler:NULL
639639
lineHandler:^(GCLineDiffChange change, NSUInteger oldLineNumber, NSUInteger newLineNumber, const char* contentBytes, NSUInteger contentLength) {
640640
/* Comparing other index to index:
641-
641+
642642
Change | Filter | Write?
643643
------------|------------|------------
644644
Unmodified | - | YES
@@ -648,7 +648,7 @@ - (BOOL)copyLinesInFile:(NSString*)path fromOtherIndex:(GCIndex*)otherIndex toIn
648648
------------|------------|------------
649649
Deleted | YES | NO
650650
| NO | YES
651-
651+
652652
*/
653653
BOOL shouldWrite = YES;
654654
switch (change) {

GitUpKit/Interface/GIImageDiffView.m

+7-7
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ - (void)updateOldImage {
151151
- (NSSize)imageSizeWithoutLoadingFromPath:(NSString*)path {
152152
NSURL* imageFileURL = [NSURL fileURLWithPath:path];
153153
CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)path.pathExtension, NULL);
154-
BOOL isPDF = [(__bridge NSString *)fileUTI isEqualToString:@"com.adobe.pdf"];
154+
BOOL isPDF = [(__bridge NSString*)fileUTI isEqualToString:@"com.adobe.pdf"];
155155
CFRelease(fileUTI);
156-
156+
157157
CGFloat width = 0.0f;
158158
CGFloat height = 0.0f;
159-
159+
160160
if (isPDF) {
161161
CGPDFDocumentRef document = CGPDFDocumentCreateWithURL((CFURLRef)imageFileURL);
162162
CGPDFPageRef page = CGPDFDocumentGetPage(document, 1);
@@ -171,7 +171,7 @@ - (NSSize)imageSizeWithoutLoadingFromPath:(NSString*)path {
171171
}
172172
CFDictionaryRef imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL);
173173
CFRelease(imageSource);
174-
174+
175175
if (imageProperties != NULL) {
176176
CFNumberRef widthNum = CFDictionaryGetValue(imageProperties, kCGImagePropertyPixelWidth);
177177
if (widthNum != NULL) {
@@ -194,7 +194,7 @@ - (NSSize)imageSizeWithoutLoadingFromPath:(NSString*)path {
194194
CFRelease(imageProperties);
195195
}
196196
}
197-
197+
198198
return NSMakeSize(width, height);
199199
}
200200

@@ -297,7 +297,7 @@ - (CGRect)desiredImageFrame:(CGFloat)width {
297297
CGSize originalImageSize = [self originalDiffImageSize];
298298
CGFloat adjustedImageWidth = originalImageSize.width;
299299
CGFloat adjustedImageHeight = originalImageSize.height;
300-
300+
301301
if (adjustedImageWidth < CGFLOAT_EPSILON) {
302302
adjustedImageWidth = 200;
303303
}
@@ -318,7 +318,7 @@ - (CGRect)fittedImageFrame {
318318
CGSize originalImageSize = [self originalDiffImageSize];
319319
CGFloat adjustedImageWidth = originalImageSize.width;
320320
CGFloat adjustedImageHeight = originalImageSize.height;
321-
321+
322322
if (adjustedImageWidth < CGFLOAT_EPSILON) {
323323
adjustedImageWidth = 200;
324324
}

GitUpKit/Utilities/GIAppKit.m

+21-22
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ - (void)awakeFromNib {
170170
[super awakeFromNib];
171171

172172
[self updateFont];
173-
174-
NSUserDefaults *defaults = NSUserDefaults.standardUserDefaults;
173+
174+
NSUserDefaults* defaults = NSUserDefaults.standardUserDefaults;
175175
self.continuousSpellCheckingEnabled = [defaults boolForKey:GICommitMessageViewUserDefaultKey_EnableSpellChecking];
176176
self.automaticSpellingCorrectionEnabled = NO; // Don't trust IB
177177
self.grammarCheckingEnabled = NO; // Don't trust IB
@@ -184,7 +184,7 @@ - (void)awakeFromNib {
184184
self.textColor = NSColor.textColor; // Don't trust IB
185185
self.backgroundColor = NSColor.textBackgroundColor; // Don't trust IB
186186
[self.textContainer replaceLayoutManager:[[GILayoutManager alloc] init]];
187-
187+
188188
self.layoutManager.showsInvisibleCharacters = [defaults boolForKey:GICommitMessageViewUserDefaultKey_ShowInvisibleCharacters];
189189

190190
[defaults addObserver:self forKeyPath:GICommitMessageViewUserDefaultKey_ShowInvisibleCharacters options:0 context:(__bridge void*)[GICommitMessageView class]];
@@ -326,7 +326,7 @@ - (void)keyDown:(NSEvent*)event {
326326

327327
@end
328328

329-
@interface GILayoutManager() <NSLayoutManagerDelegate>
329+
@interface GILayoutManager () <NSLayoutManagerDelegate>
330330
@end
331331

332332
@implementation GILayoutManager
@@ -336,45 +336,44 @@ - (instancetype)init {
336336
if (self) {
337337
self.delegate = self;
338338
}
339-
339+
340340
return self;
341341
}
342342

343-
- (NSUInteger)layoutManager:(NSLayoutManager *)layoutManager shouldGenerateGlyphs:(const CGGlyph *)glyphs properties:(const NSGlyphProperty *)props characterIndexes:(const NSUInteger *)charIndexes font:(NSFont *)aFont forGlyphRange:(NSRange)glyphRange {
344-
343+
- (NSUInteger)layoutManager:(NSLayoutManager*)layoutManager shouldGenerateGlyphs:(const CGGlyph*)glyphs properties:(const NSGlyphProperty*)props characterIndexes:(const NSUInteger*)charIndexes font:(NSFont*)aFont forGlyphRange:(NSRange)glyphRange {
345344
XLOG_DEBUG_CHECK([aFont.fontName isEqualToString:@"Menlo-Regular"]);
346-
345+
347346
if (layoutManager.showsInvisibleCharacters) {
348-
NSTextStorage *textStorage = layoutManager.textStorage;
347+
NSTextStorage* textStorage = layoutManager.textStorage;
349348
size_t glyphSize = sizeof(CGGlyph) * glyphRange.length;
350349
size_t propertySize = sizeof(NSGlyphProperty) * glyphRange.length;
351-
CGGlyph *replacementGlyphs = malloc(glyphSize);
352-
NSGlyphProperty *replacementProperties = malloc(propertySize);
350+
CGGlyph* replacementGlyphs = malloc(glyphSize);
351+
NSGlyphProperty* replacementProperties = malloc(propertySize);
353352
memcpy(replacementGlyphs, glyphs, glyphSize);
354353
memcpy(replacementProperties, props, propertySize);
355-
NSString *string = textStorage.string;
356-
357-
NSCharacterSet *spaceCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@" "];
358-
NSCharacterSet *newlineCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"\n"];
359-
354+
NSString* string = textStorage.string;
355+
356+
NSCharacterSet* spaceCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@" "];
357+
NSCharacterSet* newlineCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"\n"];
358+
360359
NSUInteger i = 0;
361360
while (i < glyphRange.length) {
362361
NSUInteger characterIndex = charIndexes[i];
363362
unichar character = [string characterAtIndex:characterIndex];
364-
363+
365364
if ([spaceCharacterSet characterIsMember:character]) {
366365
replacementGlyphs[i] = (CGGlyph)[aFont glyphWithName:@"periodcentered"];
367-
366+
368367
} else if ([newlineCharacterSet characterIsMember:character]) {
369368
replacementGlyphs[i] = (CGGlyph)[aFont glyphWithName:@"carriagereturn"];
370369
replacementProperties[i] = 0;
371370
}
372-
371+
373372
i += [string rangeOfComposedCharacterSequenceAtIndex:characterIndex].length;
374373
}
375-
374+
376375
[self setGlyphs:replacementGlyphs properties:replacementProperties characterIndexes:charIndexes font:aFont forGlyphRange:glyphRange];
377-
376+
378377
free(replacementGlyphs);
379378
free(replacementProperties);
380379
} else {
@@ -384,7 +383,7 @@ - (NSUInteger)layoutManager:(NSLayoutManager *)layoutManager shouldGenerateGlyph
384383
return glyphRange.length;
385384
}
386385

387-
- (NSControlCharacterAction)layoutManager:(NSLayoutManager *)layoutManager shouldUseAction:(NSControlCharacterAction)action forControlCharacterAtIndex:(NSUInteger)characterIndex {
386+
- (NSControlCharacterAction)layoutManager:(NSLayoutManager*)layoutManager shouldUseAction:(NSControlCharacterAction)action forControlCharacterAtIndex:(NSUInteger)characterIndex {
388387
if (layoutManager.showsInvisibleCharacters && action & NSControlCharacterActionLineBreak) {
389388
[layoutManager setNotShownAttribute:NO forGlyphAtIndex:[layoutManager glyphIndexForCharacterAtIndex:characterIndex]];
390389
}

GitUpKit/Utilities/GICustomToolbarItem.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
// Performs validation of a custom control view, or any one of two control
1919
// children.
2020
@interface GICustomToolbarItem : NSToolbarItem
21-
@property (nonatomic, weak) IBOutlet NSControl* primaryControl;
22-
@property (nonatomic, weak) IBOutlet NSControl* secondaryControl;
21+
@property(nonatomic, weak) IBOutlet NSControl* primaryControl;
22+
@property(nonatomic, weak) IBOutlet NSControl* secondaryControl;
2323
+ (void)validateAsUserInterfaceItem:(id)item;
2424
@end
2525

GitUpKit/Utilities/GILaunchServicesLocator.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ + (BOOL)hasInstalledApplicationForBundleIdentifier:(NSString*)bundleIdentifier {
103103
CFErrorRef error = NULL;
104104
NSArray* applications = CFBridgingRelease(LSCopyApplicationURLsForBundleIdentifier((__bridge CFStringRef)bundleIdentifier, &error));
105105
if (error) {
106-
//TODO: Handle error.
106+
// TODO: Handle error.
107107
CFRelease(error);
108108
return NO;
109109
}

GitUpKit/Views/GIMapViewController+Operations.m

+8-8
Original file line numberDiff line numberDiff line change
@@ -808,14 +808,14 @@ - (void)_pushLocalBranch:(GCHistoryLocalBranch*)branch toRemote:(GCRemote*)remot
808808
if (updatedBranch && remoteBranch) {
809809
if (![updatedBranch.upstream isEqualToBranch:remoteBranch]) {
810810
if (askSetUpstreamOnPush) {
811-
[self confirmUserActionWithAlertType:kGIAlertType_Note
812-
title:[NSString stringWithFormat:NSLocalizedString(@"Do you want to set the upstream for \"%@\"?", nil), updatedBranch.name]
813-
message:[NSString stringWithFormat:NSLocalizedString(@"This will configure the local branch \"%@\" to track the remote branch \"%@\" you just pushed to.", nil), updatedBranch.name, remoteBranch.name]
814-
button:NSLocalizedString(@"Set Upstream", nil)
815-
suppressionUserDefaultKey:nil
816-
block:^{
817-
[self setUpstream:remoteBranch forLocalBranch:branch];
818-
}];
811+
[self confirmUserActionWithAlertType:kGIAlertType_Note
812+
title:[NSString stringWithFormat:NSLocalizedString(@"Do you want to set the upstream for \"%@\"?", nil), updatedBranch.name]
813+
message:[NSString stringWithFormat:NSLocalizedString(@"This will configure the local branch \"%@\" to track the remote branch \"%@\" you just pushed to.", nil), updatedBranch.name, remoteBranch.name]
814+
button:NSLocalizedString(@"Set Upstream", nil)
815+
suppressionUserDefaultKey:nil
816+
block:^{
817+
[self setUpstream:remoteBranch forLocalBranch:branch];
818+
}];
819819
} else {
820820
[self setUpstream:remoteBranch forLocalBranch:branch];
821821
}

format-source.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# brew install clang-format
44

55
CLANG_FORMAT_VERSION=`clang-format -version | awk '{ print $3 }'`
6-
if [[ "$CLANG_FORMAT_VERSION" != "11.0.0" ]]; then
6+
if [[ "$CLANG_FORMAT_VERSION" < "11.0.0" ]]; then
77
echo "Unsupported clang-format version"
88
exit 1
99
fi

0 commit comments

Comments
 (0)