24
24
NSString *PBGitIndexFinishedCommit = @" PBGitIndexFinishedCommit" ;
25
25
26
26
NSString *PBGitIndexAmendMessageAvailable = @" PBGitIndexAmendMessageAvailable" ;
27
+ NSString *PBGitIndexOperationFailed = @" PBGitIndexOperationFailed" ;
27
28
28
29
@interface PBGitIndex (IndexRefreshMethods)
29
30
@@ -48,6 +49,7 @@ - (NSString *) parentTree;
48
49
- (void )postCommitUpdate : (NSString *)update ;
49
50
- (void )postCommitFailure : (NSString *)reason ;
50
51
- (void )postIndexChange ;
52
+ - (void )postOperationFailed : (NSString *)description ;
51
53
@end
52
54
53
55
@implementation PBGitIndex
@@ -237,6 +239,12 @@ - (void)postCommitFailure:(NSString *)reason
237
239
userInfo: [NSDictionary dictionaryWithObject: reason forKey: @" description" ]];
238
240
}
239
241
242
+ - (void )postOperationFailed : (NSString *)description
243
+ {
244
+ [[NSNotificationCenter defaultCenter ] postNotificationName: PBGitIndexOperationFailed
245
+ object: self
246
+ userInfo: [NSDictionary dictionaryWithObject: description forKey: @" description" ]];
247
+ }
240
248
241
249
- (BOOL )stageFiles : (NSArray *)stageFiles
242
250
{
@@ -256,8 +264,7 @@ - (BOOL)stageFiles:(NSArray *)stageFiles
256
264
retValue: &ret];
257
265
258
266
if (ret) {
259
- // FIXME: failed notification?
260
- NSLog (@" Error when updating index. Retvalue: %i " , ret);
267
+ [self postOperationFailed: [NSString stringWithFormat: @" Error in staging files. Return value: %i " , ret]];
261
268
return NO ;
262
269
}
263
270
@@ -287,8 +294,7 @@ - (BOOL)unstageFiles:(NSArray *)unstageFiles
287
294
288
295
if (ret)
289
296
{
290
- // FIXME: Failed notification
291
- NSLog (@" Error when updating index. Retvalue: %i " , ret);
297
+ [self postOperationFailed: [NSString stringWithFormat: @" Error in unstaging files. Return value: %i " , ret]];
292
298
return NO ;
293
299
}
294
300
@@ -313,8 +319,7 @@ - (void)discardChangesForFiles:(NSArray *)discardFiles
313
319
[PBEasyPipe outputForCommand: [PBGitBinary path ] withArgs: arguments inDir: [workingDirectory path ] inputString: input retValue: &ret];
314
320
315
321
if (ret) {
316
- // TODO: Post failed notification
317
- // [[commitController.repository windowController] showMessageSheet:@"Discarding changes failed" infoText:[NSString stringWithFormat:@"Discarding changes failed with error code %i", ret]];
322
+ [self postOperationFailed: [NSString stringWithFormat: @" Discarding changes failed with return value %i " , ret]];
318
323
return ;
319
324
}
320
325
@@ -337,9 +342,8 @@ - (BOOL)applyPatch:(NSString *)hunk stage:(BOOL)stage reverse:(BOOL)reverse;
337
342
inputString: hunk
338
343
retValue: &ret];
339
344
340
- // FIXME: show this error, rather than just logging it
341
345
if (ret) {
342
- NSLog ( @" Error: %@ " , error) ;
346
+ [ self postOperationFailed: [ NSString stringWithFormat: @" Applying patch failed with return value %i . Error: %@ " , ret, error]] ;
343
347
return NO ;
344
348
}
345
349
0 commit comments