Skip to content

Commit b031c1a

Browse files
authored
Merge branch 'master' into add-screenshot
2 parents 0e993a7 + bb97ec0 commit b031c1a

File tree

190 files changed

+3525
-3307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+3525
-3307
lines changed

.clang-format

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
# Custom options in the special build of clang-format (these are not standard options)
3+
# IndentNestedBlocks: false
4+
# AllowNewlineBeforeBlockParameter: false
5+
6+
# BasedOnStyle: Google
7+
AccessModifierOffset: -1
8+
ConstructorInitializerIndentWidth: 4
9+
SortIncludes: false
10+
11+
AlignAfterOpenBracket: true
12+
AlignEscapedNewlinesLeft: true
13+
AlignOperands: false
14+
AlignTrailingComments: true
15+
16+
AllowAllParametersOfDeclarationOnNextLine: false
17+
AllowShortBlocksOnASingleLine: false
18+
AllowShortCaseLabelsOnASingleLine: false
19+
AllowShortFunctionsOnASingleLine: true
20+
AllowShortIfStatementsOnASingleLine: true
21+
AllowShortFunctionsOnASingleLine: All
22+
AllowShortLoopsOnASingleLine: true
23+
24+
AlwaysBreakAfterDefinitionReturnType: false
25+
AlwaysBreakTemplateDeclarations: false
26+
AlwaysBreakBeforeMultilineStrings: false
27+
28+
BreakBeforeBinaryOperators: None
29+
BreakBeforeTernaryOperators: false
30+
BreakConstructorInitializersBeforeComma: false
31+
32+
BinPackArguments: true
33+
BinPackParameters: true
34+
ColumnLimit: 0
35+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
36+
DerivePointerAlignment: false
37+
ExperimentalAutoDetectBinPacking: false
38+
IndentCaseLabels: true
39+
IndentWrappedFunctionNames: false
40+
IndentFunctionDeclarationAfterType: false
41+
MaxEmptyLinesToKeep: 2
42+
KeepEmptyLinesAtTheStartOfBlocks: false
43+
NamespaceIndentation: Inner
44+
ObjCBlockIndentWidth: 4
45+
ObjCSpaceAfterProperty: true
46+
ObjCSpaceBeforeProtocolList: true
47+
PenaltyBreakBeforeFirstCallParameter: 10000
48+
PenaltyBreakComment: 300
49+
PenaltyBreakString: 1000
50+
PenaltyBreakFirstLessLess: 120
51+
PenaltyExcessCharacter: 1000000
52+
PenaltyReturnTypeOnItsOwnLine: 200
53+
PointerAlignment: Right
54+
SpacesBeforeTrailingComments: 1
55+
Cpp11BracedListStyle: true
56+
Standard: Auto
57+
IndentWidth: 4
58+
TabWidth: 4
59+
UseTab: Always
60+
BreakBeforeBraces: Custom
61+
BraceWrapping:
62+
AfterClass: true
63+
AfterControlStatement: false
64+
AfterEnum: false
65+
AfterFunction: true
66+
AfterNamespace: false
67+
AfterObjCDeclaration: false
68+
AfterStruct: false
69+
AfterUnion: false
70+
BeforeCatch: false
71+
BeforeElse: false
72+
IndentBraces: false
73+
74+
SpacesInParentheses: false
75+
SpacesInSquareBrackets: false
76+
SpacesInAngles: false
77+
SpaceInEmptyParentheses: false
78+
SpacesInCStyleCastParentheses: false
79+
SpaceAfterCStyleCast: false
80+
SpacesInContainerLiterals: true
81+
SpaceBeforeAssignmentOperators: true
82+
83+
ContinuationIndentWidth: 4
84+
CommentPragmas: '^ IWYU pragma:'
85+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
86+
SpaceBeforeParens: ControlStatements
87+
DisableFormat: false
88+
89+
---
90+
Language: ObjC
91+
---
92+
Language: Cpp
93+
...
94+

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
url = https://github.com/alexgorbatchev/SyntaxHighlighter.git
1010
[submodule "MGScopeBar"]
1111
path = External/MGScopeBar
12-
url = https://github.com/rowanj/MGScopeBar.git
12+
url = https://github.com/gitx/MGScopeBar.git
1313
[submodule "External/MAKVONotificationCenter"]
1414
path = External/MAKVONotificationCenter
1515
url = https://github.com/mikeash/MAKVONotificationCenter

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ osx_image: xcode8.3
33
before_install:
44
- External/objective-git/script/bootstrap
55
script:
6-
- xcodebuild -workspace GitX.xcworkspace -scheme GitX build | xcpretty
6+
- set -o pipefail && xcodebuild -workspace GitX.xcworkspace -scheme GitX build | xcpretty

Classes/Controllers/ApplicationController.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
@class PBCloneRepositoryPanel;
1313

14-
@interface ApplicationController : NSObject<NSApplicationDelegate>
15-
{
14+
@interface ApplicationController : NSObject <NSApplicationDelegate> {
1615
IBOutlet NSWindow *window;
1716
IBOutlet id firstResponder;
1817

Classes/Controllers/ApplicationController.m

Lines changed: 64 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,33 @@
2222
#import <Sparkle/SUUpdater.h>
2323
#import <Sparkle/SUUpdaterDelegate.h>
2424

25-
static OpenRecentController* recentsDialog = nil;
25+
static OpenRecentController *recentsDialog = nil;
2626

2727
@interface ApplicationController () <SUUpdaterDelegate>
2828
@end
2929

3030
@implementation ApplicationController
3131

32-
- (ApplicationController*)init
32+
- (ApplicationController *)init
3333
{
3434
#ifdef DEBUG_BUILD
3535
[NSApp activateIgnoringOtherApps:YES];
3636
#endif
3737

38-
if(!(self = [super init]))
38+
if (!(self = [super init]))
3939
return nil;
4040

41-
if(![[NSBundle bundleWithPath:@"/System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework"] load])
42-
if(![[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load])
41+
if (![[NSBundle bundleWithPath:@"/System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework"] load])
42+
if (![[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load])
4343
NSLog(@"Could not load QuickLook");
4444

4545
/* Value Transformers */
4646
NSValueTransformer *transformer = [[PBNSURLPathUserDefaultsTransfomer alloc] init];
4747
[NSValueTransformer setValueTransformer:transformer forName:@"PBNSURLPathUserDefaultsTransfomer"];
48-
48+
4949
// Make sure the PBGitDefaults is initialized, by calling a random method
5050
[PBGitDefaults class];
51-
51+
5252
started = NO;
5353
return self;
5454
}
@@ -64,27 +64,27 @@ - (void)registerServices
6464

6565
// Force update the services menu if we have a new services version
6666
NSInteger serviceVersion = [[NSUserDefaults standardUserDefaults] integerForKey:@"Services Version"];
67-
if (serviceVersion < 2)
68-
{
67+
if (serviceVersion < 2) {
6968
NSLog(@"Updating services menu…");
7069
NSUpdateDynamicServices();
7170
[[NSUserDefaults standardUserDefaults] setInteger:2 forKey:@"Services Version"];
7271
}
7372
}
7473

75-
- (void)application:(NSApplication *)sender openFiles:(NSArray <NSString *> *)filenames {
76-
PBRepositoryDocumentController * controller = [PBRepositoryDocumentController sharedDocumentController];
77-
78-
for (NSString * filename in filenames) {
79-
NSURL * repository = [NSURL fileURLWithPath:filename];
80-
[controller openDocumentWithContentsOfURL:repository display:YES
81-
completionHandler:^void (NSDocument *document, BOOL documentWasAlreadyOpen, NSError *error) {
74+
- (void)application:(NSApplication *)sender openFiles:(NSArray<NSString *> *)filenames
75+
{
76+
PBRepositoryDocumentController *controller = [PBRepositoryDocumentController sharedDocumentController];
77+
78+
for (NSString *filename in filenames) {
79+
NSURL *repository = [NSURL fileURLWithPath:filename];
80+
[controller openDocumentWithContentsOfURL:repository
81+
display:YES
82+
completionHandler:^void(NSDocument *document, BOOL documentWasAlreadyOpen, NSError *error) {
8283
if (!document) {
8384
NSLog(@"Error opening repository \"%@\": %@", repository.path, error);
8485
[controller presentError:error];
8586
[sender replyToOpenOrPrint:NSApplicationDelegateReplyFailure];
86-
}
87-
else {
87+
} else {
8888
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
8989
}
9090
}];
@@ -93,60 +93,60 @@ - (void)application:(NSApplication *)sender openFiles:(NSArray <NSString *> *)fi
9393

9494
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
9595
{
96-
if(!started || [[[NSDocumentController sharedDocumentController] documents] count])
96+
if (!started || [[[NSDocumentController sharedDocumentController] documents] count])
9797
return NO;
9898
return YES;
9999
}
100100

101101
- (BOOL)applicationOpenUntitledFile:(NSApplication *)theApplication
102102
{
103103
recentsDialog = [[OpenRecentController alloc] init];
104-
if ([recentsDialog.possibleResults count] > 0)
105-
{
104+
if ([recentsDialog.possibleResults count] > 0) {
106105
[recentsDialog show];
107106
return YES;
108-
}
109-
else
110-
{
107+
} else {
111108
return NO;
112109
}
113110
}
114111

115-
- (void)applicationDidFinishLaunching:(NSNotification*)notification
112+
- (void)applicationDidFinishLaunching:(NSNotification *)notification
116113
{
117114
[[SUUpdater sharedUpdater] setSendsSystemProfile:YES];
118-
[[SUUpdater sharedUpdater] setDelegate:self];
115+
[[SUUpdater sharedUpdater] setDelegate:self];
119116

120117
// Make sure Git's SSH password requests get forwarded to our little UI tool:
121-
setenv( "SSH_ASKPASS", [[[NSBundle mainBundle] pathForResource: @"gitx_askpasswd" ofType: @""] UTF8String], 1 );
122-
setenv( "DISPLAY", "localhost:0", 1 );
118+
setenv("SSH_ASKPASS", [[[NSBundle mainBundle] pathForResource:@"gitx_askpasswd" ofType:@""] UTF8String], 1);
119+
setenv("DISPLAY", "localhost:0", 1);
123120

124121
[NSApp registerObserverForAppearanceChanges:self];
125122
[self registerServices];
126123
started = YES;
127124
}
128125

129-
- (void) windowWillClose: sender
126+
- (void)windowWillClose:sender
130127
{
131-
[firstResponder terminate: sender];
128+
[firstResponder terminate:sender];
132129
}
133130

134131
//Override the default behavior
135-
- (IBAction)openDocument:(id)sender {
136-
NSOpenPanel* panel = [[NSOpenPanel alloc] init];
137-
132+
- (IBAction)openDocument:(id)sender
133+
{
134+
NSOpenPanel *panel = [[NSOpenPanel alloc] init];
135+
138136
[panel setCanChooseFiles:false];
139137
[panel setCanChooseDirectories:true];
140-
138+
141139
[panel beginWithCompletionHandler:^(NSInteger result) {
142140
if (result == NSFileHandlingPanelOKButton) {
143-
PBRepositoryDocumentController* controller = [PBRepositoryDocumentController sharedDocumentController];
144-
[controller openDocumentWithContentsOfURL:panel.URL display:true completionHandler:^(NSDocument * _Nullable document, BOOL documentWasAlreadyOpen, NSError * _Nullable error) {
145-
if (!document) {
146-
NSLog(@"Error opening repository \"%@\": %@", panel.URL.path, error);
147-
[controller presentError:error];
148-
}
149-
}];
141+
PBRepositoryDocumentController *controller = [PBRepositoryDocumentController sharedDocumentController];
142+
[controller openDocumentWithContentsOfURL:panel.URL
143+
display:true
144+
completionHandler:^(NSDocument *_Nullable document, BOOL documentWasAlreadyOpen, NSError *_Nullable error) {
145+
if (!document) {
146+
NSLog(@"Error opening repository \"%@\": %@", panel.URL.path, error);
147+
[controller presentError:error];
148+
}
149+
}];
150150
}
151151
}];
152152
}
@@ -163,16 +163,16 @@ - (IBAction)showAboutPanel:(id)sender
163163
if (gitversion)
164164
[dict addEntriesFromDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:gitversion, @"Version", nil]];
165165

166-
#ifdef DEBUG_BUILD
167-
[dict addEntriesFromDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:@"GitX-dev (DEBUG)", @"ApplicationName", nil]];
168-
#endif
166+
#ifdef DEBUG_BUILD
167+
[dict addEntriesFromDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:@"GitX-dev (DEBUG)", @"ApplicationName", nil]];
168+
#endif
169169

170170
[dict addEntriesFromDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:@"GitX-dev (rowanj fork)", @"ApplicationName", nil]];
171171

172172
[NSApp orderFrontStandardAboutPanelWithOptions:dict];
173173
}
174174

175-
- (IBAction) showCloneRepository:(id)sender
175+
- (IBAction)showCloneRepository:(id)sender
176176
{
177177
if (!cloneRepositoryPanel)
178178
cloneRepositoryPanel = [PBCloneRepositoryPanel panel];
@@ -182,19 +182,19 @@ - (IBAction) showCloneRepository:(id)sender
182182

183183
- (IBAction)installCliTool:(id)sender;
184184
{
185-
BOOL success = NO;
186-
NSString* installationPath = @"/usr/local/bin/";
187-
NSString* installationName = @"gitx";
188-
NSString* toolPath = [[NSBundle mainBundle] pathForResource:@"gitx" ofType:@""];
185+
BOOL success = NO;
186+
NSString *installationPath = @"/usr/local/bin/";
187+
NSString *installationName = @"gitx";
188+
NSString *toolPath = [[NSBundle mainBundle] pathForResource:@"gitx" ofType:@""];
189189
if (toolPath) {
190190
AuthorizationRef auth;
191191
if (AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth) == errAuthorizationSuccess) {
192-
char const* mkdir_arg[] = { "-p", [installationPath UTF8String], NULL};
193-
char const* mkdir = "/bin/mkdir";
194-
AuthorizationExecuteWithPrivileges(auth, mkdir, kAuthorizationFlagDefaults, (char**)mkdir_arg, NULL);
195-
char const* arguments[] = { "-f", "-s", [toolPath UTF8String], [[installationPath stringByAppendingString: installationName] UTF8String], NULL };
196-
char const* helperTool = "/bin/ln";
197-
if (AuthorizationExecuteWithPrivileges(auth, helperTool, kAuthorizationFlagDefaults, (char**)arguments, NULL) == errAuthorizationSuccess) {
192+
char const *mkdir_arg[] = {"-p", [installationPath UTF8String], NULL};
193+
char const *mkdir = "/bin/mkdir";
194+
AuthorizationExecuteWithPrivileges(auth, mkdir, kAuthorizationFlagDefaults, (char **)mkdir_arg, NULL);
195+
char const *arguments[] = {"-f", "-s", [toolPath UTF8String], [[installationPath stringByAppendingString:installationName] UTF8String], NULL};
196+
char const *helperTool = "/bin/ln";
197+
if (AuthorizationExecuteWithPrivileges(auth, helperTool, kAuthorizationFlagDefaults, (char **)arguments, NULL) == errAuthorizationSuccess) {
198198
int status;
199199
int pid = wait(&status);
200200
if (pid != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
@@ -207,7 +207,7 @@ - (IBAction)installCliTool:(id)sender;
207207
}
208208
}
209209

210-
NSAlert * alert = [[NSAlert alloc] init];
210+
NSAlert *alert = [[NSAlert alloc] init];
211211
if (success) {
212212
alert.messageText = NSLocalizedString(@"Installation Complete", @"Headline for successfully completed installation of the command line tool");
213213
alert.informativeText = [NSString stringWithFormat:NSLocalizedString(@"The gitx tool has been installed to %@.", @"Informative text for successfully completed installation of the command line tool at the location %@"), installationPath];
@@ -225,20 +225,20 @@ - (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:
225225
NSArray *keys = [NSArray arrayWithObjects:@"key", @"displayKey", @"value", @"displayValue", nil];
226226
NSMutableArray *feedParameters = [NSMutableArray array];
227227

228-
// only add parameters if the profile is being sent this time
229-
if (sendingProfile) {
230-
NSString *CFBundleGitVersion = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleGitVersion"];
228+
// only add parameters if the profile is being sent this time
229+
if (sendingProfile) {
230+
NSString *CFBundleGitVersion = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleGitVersion"];
231231
if (CFBundleGitVersion)
232-
[feedParameters addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"CFBundleGitVersion", @"Full Version", CFBundleGitVersion, CFBundleGitVersion, nil]
232+
[feedParameters addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"CFBundleGitVersion", @"Full Version", CFBundleGitVersion, CFBundleGitVersion, nil]
233233
forKeys:keys]];
234234

235-
NSString *gitVersion = [PBGitBinary version];
235+
NSString *gitVersion = [PBGitBinary version];
236236
if (gitVersion)
237-
[feedParameters addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"gitVersion", @"git Version", gitVersion, gitVersion, nil]
237+
[feedParameters addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"gitVersion", @"git Version", gitVersion, gitVersion, nil]
238238
forKeys:keys]];
239239
}
240240

241-
return feedParameters;
241+
return feedParameters;
242242
}
243243

244244

@@ -251,7 +251,7 @@ - (IBAction)showHelp:(id)sender
251251

252252
- (IBAction)reportAProblem:(id)sender
253253
{
254-
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/gitx/gitx/issues"]];
254+
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/gitx/gitx/issues"]];
255255
}
256256

257257
- (IBAction)showChangeLog:(id)sender
@@ -260,5 +260,4 @@ - (IBAction)showChangeLog:(id)sender
260260
}
261261

262262

263-
264263
@end

0 commit comments

Comments
 (0)