Add --init and --clone to gitx CLI and Applescript

Allows creating repositories from the command line, Applescript, or the scripting bridge. These are basic commands, if you need to use commandline options then use git itself.
This commit is contained in:
Nathan Kinsinger
2010-08-21 18:50:12 -06:00
parent b9232721d0
commit 17f50e3f7e
10 changed files with 135 additions and 15 deletions
+11 -10
View File
@@ -47,6 +47,16 @@
return document;
}
- (void)initNewRepositoryAtURL:(NSURL *)url
{
int terminationStatus;
NSString *result = [PBEasyPipe outputForCommand:[PBGitBinary path] withArgs:[NSArray arrayWithObjects:@"init", @"-q", nil] inDir:[url path] retValue:&terminationStatus];
if (terminationStatus == 0)
[self openDocumentWithContentsOfURL:url display:YES error:NULL];
else
NSRunAlertPanel(@"Failed to create new Git repository", @"Git returned the following error when trying to create the repository: %@", nil, nil, nil, result);
}
- (IBAction)newDocument:(id)sender
{
@@ -58,16 +68,7 @@
[op setMessage:@"Initialize a repository here:"];
[op setTitle:@"New Repository"];
if ([op runModal] == NSFileHandlingPanelOKButton)
{
NSString *path = [op filename];
int terminationStatus;
NSString *result = [PBEasyPipe outputForCommand:[PBGitBinary path] withArgs:[NSArray arrayWithObjects:@"init", @"-q", nil] inDir:path inputString:nil retValue:&terminationStatus];
if (terminationStatus == 0)
[self openDocumentWithContentsOfURL:[op URL] display:YES error:NULL];
else
NSRunAlertPanel(@"Failed to create new Git repository", @"Git returned the following error when trying to create the repository: %@", nil, nil, nil, result);
}
[self initNewRepositoryAtURL:[op URL]];
}