@@ -19,6 +19,7 @@ - (void)refreshFinished:(NSNotification *)notification;
19
19
- (void )commitStatusUpdated : (NSNotification *)notification ;
20
20
- (void )commitFinished : (NSNotification *)notification ;
21
21
- (void )commitFailed : (NSNotification *)notification ;
22
+ - (void )amendCommit : (NSNotification *)notification ;
22
23
@end
23
24
24
25
@implementation PBGitCommitController
@@ -37,6 +38,7 @@ - (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGit
37
38
[[NSNotificationCenter defaultCenter ] addObserver: self selector: @selector (commitStatusUpdated: ) name: PBGitIndexCommitStatus object: index ];
38
39
[[NSNotificationCenter defaultCenter ] addObserver: self selector: @selector (commitFinished: ) name: PBGitIndexFinishedCommit object: index ];
39
40
[[NSNotificationCenter defaultCenter ] addObserver: self selector: @selector (commitFailed: ) name: PBGitIndexCommitFailed object: index ];
41
+ [[NSNotificationCenter defaultCenter ] addObserver: self selector: @selector (amendCommit: ) name: PBGitIndexAmendMessageAvailable object: index ];
40
42
41
43
return self;
42
44
}
@@ -56,11 +58,13 @@ - (void)awakeFromNib
56
58
[cachedFilesController setSortDescriptors: [NSArray arrayWithObject:
57
59
[[NSSortDescriptor alloc ] initWithKey: @" path" ascending: true ]]];
58
60
}
61
+
59
62
- (void ) removeView
60
63
{
61
64
[webController closeView ];
62
65
[super finalize ];
63
66
}
67
+
64
68
- (NSResponder *)firstResponder ;
65
69
{
66
70
return commitMessageView;
@@ -151,5 +155,16 @@ - (void)commitFailed:(NSNotification *)notification
151
155
[[repository windowController ] showMessageSheet: @" Commit failed" infoText: reason];
152
156
}
153
157
158
+ - (void )amendCommit : (NSNotification *)notification
159
+ {
160
+ // Replace commit message with the old one if it's less than 3 characters long.
161
+ // This is just a random number.
162
+ if ([[commitMessageView string ] length ] > 3 )
163
+ return ;
164
+
165
+ NSString *message = [[notification userInfo ] objectForKey: @" message" ];
166
+ commitMessageView.string = message;
167
+ }
168
+
154
169
155
170
@end
0 commit comments