Skip to content

Commit 21d1f39

Browse files
committed
Added a dialog for failing commit hooks
This enables the user to force a commit (i.e. --no-verify) when either pre-commit or commit-msg hook fails.
1 parent ed83316 commit 21d1f39

12 files changed

+1425
-23
lines changed

GitX.xcodeproj/project.pbxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
/* End PBXAggregateTarget section */
2222

2323
/* Begin PBXBuildFile section */
24+
02B41A5E123E307200DFC531 /* PBCommitHookFailedSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 02B41A5D123E307200DFC531 /* PBCommitHookFailedSheet.m */; };
25+
02B41A60123E307F00DFC531 /* PBCommitHookFailedSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */; };
2426
056438B70ED0C40B00985397 /* DetailViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 056438B60ED0C40B00985397 /* DetailViewTemplate.png */; };
2527
3BC07F4C0ED5A5C5009A7768 /* HistoryViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 3BC07F4A0ED5A5C5009A7768 /* HistoryViewTemplate.png */; };
2628
3BC07F4D0ED5A5C5009A7768 /* CommitViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 3BC07F4B0ED5A5C5009A7768 /* CommitViewTemplate.png */; };
@@ -237,6 +239,9 @@
237239
/* End PBXCopyFilesBuildPhase section */
238240

239241
/* Begin PBXFileReference section */
242+
02B41A5C123E307200DFC531 /* PBCommitHookFailedSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCommitHookFailedSheet.h; sourceTree = "<group>"; };
243+
02B41A5D123E307200DFC531 /* PBCommitHookFailedSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCommitHookFailedSheet.m; sourceTree = "<group>"; };
244+
02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PBCommitHookFailedSheet.xib; sourceTree = "<group>"; };
240245
056438B60ED0C40B00985397 /* DetailViewTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DetailViewTemplate.png; path = Images/DetailViewTemplate.png; sourceTree = "<group>"; };
241246
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
242247
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
@@ -620,6 +625,7 @@
620625
29B97317FDCFA39411CA2CEA /* Resources */ = {
621626
isa = PBXGroup;
622627
children = (
628+
02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */,
623629
F5F7D0641062E7940072C81C /* UpdateKey.pem */,
624630
F50A41130EBB872D00208746 /* Widgets */,
625631
47DBDB920E94F47200671A1E /* Preference Icons */,
@@ -691,6 +697,8 @@
691697
D82F435F111B9C6D00A25A39 /* Sheets */ = {
692698
isa = PBXGroup;
693699
children = (
700+
02B41A5C123E307200DFC531 /* PBCommitHookFailedSheet.h */,
701+
02B41A5D123E307200DFC531 /* PBCommitHookFailedSheet.m */,
694702
D854948410D5C01B0083B917 /* PBCreateBranchSheet.h */,
695703
D854948510D5C01B0083B917 /* PBCreateBranchSheet.m */,
696704
D8E3B34B10DCA958001096A3 /* PBCreateTagSheet.h */,
@@ -1172,6 +1180,7 @@
11721180
D8022FE811E124A0003C21F6 /* PBGitXMessageSheet.xib in Resources */,
11731181
D8F01C4B12182F19007F729F /* GitX.sdef in Resources */,
11741182
D8F4AB7912298CE200D6D53C /* rewindImage.pdf in Resources */,
1183+
02B41A60123E307F00DFC531 /* PBCommitHookFailedSheet.xib in Resources */,
11751184
);
11761185
runOnlyForDeploymentPostprocessing = 0;
11771186
};
@@ -1321,6 +1330,7 @@
13211330
D8F01D531218A164007F729F /* NSApplication+GitXScripting.m in Sources */,
13221331
D8B4DC571220D1E4004166D6 /* PBHistorySearchController.m in Sources */,
13231332
D8712A00122B14EC00012334 /* GitXTextFieldCell.m in Sources */,
1333+
02B41A5E123E307200DFC531 /* PBCommitHookFailedSheet.m in Sources */,
13241334
);
13251335
runOnlyForDeploymentPostprocessing = 0;
13261336
};

PBCommitHookFailedSheet.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// PBCommitHookFailedSheet.h
3+
// GitX
4+
//
5+
// Created by Sebastian Staudt on 9/12/10.
6+
// Copyright 2010 Sebastian Staudt. All rights reserved.
7+
//
8+
9+
#import <Cocoa/Cocoa.h>
10+
11+
#import "PBGitCommitController.h"
12+
#import "PBGitXMessageSheet.h"
13+
14+
15+
@interface PBCommitHookFailedSheet : PBGitXMessageSheet
16+
{
17+
PBGitCommitController *commitController;
18+
}
19+
20+
+ (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSString *)message infoText:(NSString *)info commitController:(PBGitCommitController *)controller;
21+
22+
- (id)initWithWindowNibName:(NSString *)windowNibName andController:(PBGitCommitController *)controller;
23+
- (IBAction)forceCommit:(id)sender;
24+
25+
@end

PBCommitHookFailedSheet.m

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// PBCommitHookFailedSheet.m
3+
// GitX
4+
//
5+
// Created by Sebastian Staudt on 9/12/10.
6+
// Copyright 2010 Sebastian Staudt. All rights reserved.
7+
//
8+
9+
#import "PBCommitHookFailedSheet.h"
10+
#import "PBGitWindowController.h"
11+
12+
13+
@implementation PBCommitHookFailedSheet
14+
15+
#pragma mark -
16+
#pragma mark PBCommitHookFailedSheet
17+
18+
+ (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSString *)message infoText:(NSString *)info commitController:(PBGitCommitController *)controller
19+
{
20+
PBCommitHookFailedSheet *sheet = [[self alloc] initWithWindowNibName:@"PBCommitHookFailedSheet" andController:controller];
21+
[sheet beginMessageSheetForWindow:parentWindow withMessageText:message infoText:info];
22+
}
23+
24+
- (id)initWithWindowNibName:(NSString *)windowNibName andController:(PBGitCommitController *)controller;
25+
{
26+
self = [self initWithWindowNibName:windowNibName];
27+
commitController = controller;
28+
29+
return self;
30+
}
31+
32+
- (IBAction)forceCommit:(id)sender
33+
{
34+
[self closeMessageSheet:self];
35+
[commitController forceCommit:sender];
36+
}
37+
38+
@end

0 commit comments

Comments
 (0)