diff --git a/PBGitCommitController.m b/PBGitCommitController.m index d1b29ec..38ecc13 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -127,35 +127,5 @@ [commitMessageView setString:@""]; } -- (void) stageHunk:(NSString *)hunk reverse:(BOOL)reverse -{ - [self processHunk:hunk stage:TRUE reverse:reverse]; -} - -- (void)discardHunk:(NSString *)hunk -{ - [self processHunk:hunk stage:FALSE reverse:TRUE]; -} - -- (void)processHunk:(NSString *)hunk stage:(BOOL)stage reverse:(BOOL)reverse -{ - NSMutableArray *array = [NSMutableArray arrayWithObjects:@"apply", nil]; - if (stage) - [array addObject:@"--cached"]; - if (reverse) - [array addObject:@"--reverse"]; - - int ret = 1; - NSString *error = [repository outputForArguments:array - inputString:hunk - retValue:&ret]; - - // FIXME: show this error, rather than just logging it - if (ret) - NSLog(@"Error: %@", error); - - // TODO: We should do this smarter by checking if the file diff is empty, which is faster. - [self refresh:self]; -} @end diff --git a/PBWebChangesController.m b/PBWebChangesController.m index 96b9a5c..592e596 100644 --- a/PBWebChangesController.m +++ b/PBWebChangesController.m @@ -82,10 +82,11 @@ [NSNumber numberWithBool:selectedFileIsCached], nil]]; } -- (void) stageHunk:(NSString *)hunk reverse:(BOOL)reverse +- (void)stageHunk:(NSString *)hunk reverse:(BOOL)reverse { - //[controller stageHunk: hunk reverse:reverse]; + [controller.index applyPatch:hunk stage:YES reverse:reverse]; // FIXME: Don't need a hard refresh + [self refresh]; } @@ -101,7 +102,7 @@ } if (ret == NSAlertDefaultReturn) { - // [controller discardHunk:hunk]; + [controller.index applyPatch:hunk stage:NO reverse:YES]; [self refresh]; } }