Skip to content

Commit 615437e

Browse files
committed
Fix the sodding gitx --client command; damn
I've missed this working for SIX FUCKING YEARS.
1 parent b39a45e commit 615437e

File tree

6 files changed

+31
-135
lines changed

6 files changed

+31
-135
lines changed

Classes/Controllers/ApplicationController.m

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#import "PBCloneRepositoryPanel.h"
1818
#import "OpenRecentController.h"
1919
#import "PBGitBinary.h"
20+
#import "PBGitRepositoryDocument.h"
21+
#import "PBRepositoryFinder.h"
2022

2123
static OpenRecentController* recentsDialog = nil;
2224

@@ -70,20 +72,34 @@ - (void)registerServices
7072

7173
- (void)application:(NSApplication *)sender openFiles:(NSArray <NSString *> *)filenames {
7274
PBRepositoryDocumentController * controller = [PBRepositoryDocumentController sharedDocumentController];
73-
75+
76+
NSScriptCommand *command = [NSScriptCommand currentCommand];
7477
for (NSString * filename in filenames) {
7578
NSURL * repository = [NSURL fileURLWithPath:filename];
76-
[controller openDocumentWithContentsOfURL:repository display:YES
77-
completionHandler:^void (NSDocument *document, BOOL documentWasAlreadyOpen, NSError *error) {
78-
if (!document) {
79-
NSLog(@"Error opening repository \"%@\": %@", repository.path, error);
80-
[controller presentError:error];
81-
[sender replyToOpenOrPrint:NSApplicationDelegateReplyFailure];
82-
}
83-
else {
84-
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
85-
}
86-
}];
79+
[controller openDocumentWithContentsOfURL:repository display:YES completionHandler:^void (NSDocument *_document, BOOL documentWasAlreadyOpen, NSError *error) {
80+
if (!_document) {
81+
NSLog(@"Error opening repository \"%@\": %@", repository.path, error);
82+
[controller presentError:error];
83+
[sender replyToOpenOrPrint:NSApplicationDelegateReplyFailure];
84+
}
85+
else {
86+
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
87+
}
88+
89+
if (command) {
90+
PBGitRepositoryDocument *document = (id)_document;
91+
NSURL *repoURL = [command directParameter];
92+
93+
// on app launch there may be many repositories opening, so double check that this is the right repo
94+
if (repoURL) {
95+
repoURL = [PBRepositoryFinder gitDirForURL:repoURL];
96+
if ([repoURL isEqual:[document.fileURL URLByAppendingPathComponent:@".git"]]) {
97+
NSArray *arguments = command.arguments[@"openOptions"];
98+
[document handleGitXScriptingArguments:arguments];
99+
}
100+
}
101+
}
102+
}];
87103
}
88104
}
89105

Classes/Controllers/PBGitRepositoryDocument.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ extern NSString *PBGitRepositoryDocumentType;
2929

3030
- (PBGitWindowController *)windowController;
3131

32+
- (void)handleGitXScriptingArguments:(NSArray *)arguments;
33+
3234
@end

Classes/Controllers/PBGitRepositoryDocument.m

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -111,25 +111,8 @@ - (void)selectRevisionSpecifier:(PBGitRevSpecifier *)specifier {
111111
[self showHistoryView:self];
112112
}
113113

114-
- (void)showWindows
115-
{
116-
NSScriptCommand *command = [NSScriptCommand currentCommand];
117-
118-
if (command) {
119-
NSURL *repoURL = [command directParameter];
120-
121-
// on app launch there may be many repositories opening, so double check that this is the right repo
122-
if (repoURL) {
123-
repoURL = [PBRepositoryFinder gitDirForURL:repoURL];
124-
if ([repoURL isEqual:self.fileURL]) {
125-
NSArray *arguments = command.arguments[@"openOptions"];
126-
[self handleGitXScriptingArguments:arguments];
127-
}
128-
}
129-
}
130-
114+
- (void)showWindows {
131115
[[[self windowController] window] setTitle:[self displayName]];
132-
133116
[super showWindows];
134117
}
135118

Classes/PBCLIProxy.h

Lines changed: 0 additions & 23 deletions
This file was deleted.

Classes/PBCLIProxy.m

Lines changed: 0 additions & 74 deletions
This file was deleted.

GitX.xcodeproj/project.pbxproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
4A5D771114A9A9CC00DF6C68 /* GitXRelativeDateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A5D768914A9A9CC00DF6C68 /* GitXRelativeDateFormatter.m */; };
9696
4A5D771214A9A9CC00DF6C68 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A5D768B14A9A9CC00DF6C68 /* main.m */; };
9797
4A5D771314A9A9CC00DF6C68 /* PBChangedFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A5D768D14A9A9CC00DF6C68 /* PBChangedFile.m */; };
98-
4A5D771414A9A9CC00DF6C68 /* PBCLIProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A5D768F14A9A9CC00DF6C68 /* PBCLIProxy.m */; };
9998
4A5D771514A9A9CC00DF6C68 /* PBCommitList.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A5D769114A9A9CC00DF6C68 /* PBCommitList.m */; };
10099
4A5D771614A9A9CC00DF6C68 /* PBGraphCellInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A5D769314A9A9CC00DF6C68 /* PBGraphCellInfo.m */; };
101100
4A5D771714A9A9CC00DF6C68 /* PBNSURLPathUserDefaultsTransfomer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A5D769514A9A9CC00DF6C68 /* PBNSURLPathUserDefaultsTransfomer.m */; };
@@ -394,8 +393,6 @@
394393
4A5D768B14A9A9CC00DF6C68 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
395394
4A5D768C14A9A9CC00DF6C68 /* PBChangedFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBChangedFile.h; sourceTree = "<group>"; };
396395
4A5D768D14A9A9CC00DF6C68 /* PBChangedFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBChangedFile.m; sourceTree = "<group>"; };
397-
4A5D768E14A9A9CC00DF6C68 /* PBCLIProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCLIProxy.h; sourceTree = "<group>"; };
398-
4A5D768F14A9A9CC00DF6C68 /* PBCLIProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PBCLIProxy.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
399396
4A5D769014A9A9CC00DF6C68 /* PBCommitList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCommitList.h; sourceTree = "<group>"; };
400397
4A5D769114A9A9CC00DF6C68 /* PBCommitList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCommitList.m; sourceTree = "<group>"; };
401398
4A5D769214A9A9CC00DF6C68 /* PBGraphCellInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGraphCellInfo.h; sourceTree = "<group>"; };
@@ -746,8 +743,6 @@
746743
373F9A1F1EAF97A200A77B4C /* NSSplitView+GitX.m */,
747744
4A5D768C14A9A9CC00DF6C68 /* PBChangedFile.h */,
748745
4A5D768D14A9A9CC00DF6C68 /* PBChangedFile.m */,
749-
4A5D768E14A9A9CC00DF6C68 /* PBCLIProxy.h */,
750-
4A5D768F14A9A9CC00DF6C68 /* PBCLIProxy.m */,
751746
4A5D769014A9A9CC00DF6C68 /* PBCommitList.h */,
752747
4A5D769114A9A9CC00DF6C68 /* PBCommitList.m */,
753748
4A5D769214A9A9CC00DF6C68 /* PBGraphCellInfo.h */,
@@ -1268,7 +1263,6 @@
12681263
4A5D771214A9A9CC00DF6C68 /* main.m in Sources */,
12691264
2682AABB1929140E00271A4D /* GTOID+JavaScript.m in Sources */,
12701265
4A5D771314A9A9CC00DF6C68 /* PBChangedFile.m in Sources */,
1271-
4A5D771414A9A9CC00DF6C68 /* PBCLIProxy.m in Sources */,
12721266
4D3FB3E7198AEAAF000B4A58 /* PBGitRepositoryDocument.m in Sources */,
12731267
4A5D771514A9A9CC00DF6C68 /* PBCommitList.m in Sources */,
12741268
4A5D771614A9A9CC00DF6C68 /* PBGraphCellInfo.m in Sources */,
@@ -1521,7 +1515,6 @@
15211515
MACOSX_DEPLOYMENT_TARGET = 10.9;
15221516
ONLY_ACTIVE_ARCH = YES;
15231517
OTHER_CFLAGS = "-Werror=incompatible-pointer-types";
1524-
RUN_CLANG_STATIC_ANALYZER = YES;
15251518
SDKROOT = macosx;
15261519
STRIP_INSTALLED_PRODUCT = NO;
15271520
VALID_ARCHS = x86_64;
@@ -1568,7 +1561,6 @@
15681561
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
15691562
MACOSX_DEPLOYMENT_TARGET = 10.9;
15701563
OTHER_CFLAGS = "-Werror=incompatible-pointer-types";
1571-
RUN_CLANG_STATIC_ANALYZER = YES;
15721564
SDKROOT = macosx;
15731565
VALID_ARCHS = x86_64;
15741566
};

0 commit comments

Comments
 (0)