Skip to content

Commit 2cedd04

Browse files
committed
Merge pull request #154 from lukeman/fix-open-dialog
prevents open dialog from appearing when opening a repo from the cli
2 parents b9476a1 + b598367 commit 2cedd04

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

ApplicationController.m

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ - (void)applicationDidFinishLaunching:(NSNotification*)notification
129129

130130
if (![[NSApplication sharedApplication] isActive])
131131
return;
132-
133-
// The current directory was not enabled or could not be opened (most likely it’s not a git repository).
134-
// show an open panel for the user to select a repository to view
135-
if ([PBGitDefaults showOpenPanelOnLaunch] && !hasOpenedDocuments && cloneRepositoryPanel == nil)
136-
[[PBRepositoryDocumentController sharedDocumentController] openDocument:self];
137132
}
138133

139134
- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
@@ -405,6 +400,19 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification
405400
[[NSNotificationCenter defaultCenter] removeObserver:self];
406401
}
407402

403+
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
404+
{
405+
id dc = [PBRepositoryDocumentController sharedDocumentController];
406+
407+
// Reopen last document if user prefers
408+
if ([PBGitDefaults showOpenPanelOnLaunch])
409+
{
410+
[dc openDocument:self];
411+
}
412+
413+
return NO;
414+
}
415+
408416
/**
409417
Implementation of dealloc, to release the retained variables.
410418
*/

0 commit comments

Comments
 (0)