Permalink
Browse files

Detect and report error from git clone. Bump version to 0.6

  • Loading branch information...
1 parent 20206cf commit e6b1536b921be488cfcdabbaa5eb0ae0930e4823 Brian Cooke committed Jan 30, 2012
Showing with 11 additions and 3 deletions.
  1. +1 −1 Clone/Clone-Info.plist
  2. +2 −1 Clone/Models/RSCGitCloner.h
  3. +1 −1 Clone/Models/RSCGitCloner.m
  4. +7 −0 Clone/RSCAppDelegate.m
@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>0.5</string>
+ <string>0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@@ -3,7 +3,8 @@
typedef enum {
kRSCGitClonerErrorNone = 0,
- kRSCGitClonerErrorAuthenticationRequired
+ kRSCGitClonerErrorAuthenticationRequired,
+ kRSCGitClonerErrorCloning
} kRSCGitClonerErrors;
typedef void (^RSCCloneBlock)(NSInteger);
@@ -117,7 +117,7 @@ - (void) clone
task.terminationHandler = ^(NSTask *theTask) {
if (self.didTerminate == NO) {
- self.completionBlock(kRSCGitClonerErrorNone);
+ self.completionBlock(theTask.terminationStatus == 0 ? kRSCGitClonerErrorNone : kRSCGitClonerErrorCloning);
}
};
}
@@ -47,6 +47,9 @@ - (void)cloneUrl:(NSString *)repoURL
{
DLog(@"Cloning: %@", repoURL);
+ [self.progressIndicator setIndeterminate:YES];
+ [self.progressIndicator startAnimation:self];
+
RSCGitCloner *cloner = [[RSCGitCloner alloc] initWithRepositoryURL:repoURL];
void (^cloneProgressBlock)(NSInteger progress) = ^(NSInteger progress) {
@@ -66,6 +69,10 @@ - (void)cloneUrl:(NSString *)repoURL
// we no longer have a reason to live. We'll be called upon again by the bookmarklet when needed.
[NSApp terminate:self];
+ } else if (responseCode == kRSCGitClonerErrorCloning) {
+ NSAlert *alert = [NSAlert alertWithMessageText:@"Unable to clone" defaultButton:@"Quit" alternateButton:nil otherButton:nil informativeTextWithFormat:@"git clone %@ failed.\n\nMake sure you were on a valid github URL and try again.", cloner.repositoryURL];
+ [alert runModal];
+ [NSApp terminate:self];
} else if (responseCode == kRSCGitClonerErrorAuthenticationRequired) {
DLog(@"Prompt for username and password!");

0 comments on commit e6b1536

Please sign in to comment.