From 8637a21c3b6620ac87e03516b5e8f121e82b83b3 Mon Sep 17 00:00:00 2001 From: Joshua Bleecher Snyder Date: Fri, 9 Jul 2010 10:07:40 -0700 Subject: [PATCH 01/14] Display output of pre-commit hook --- PBGitIndex.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PBGitIndex.m b/PBGitIndex.m index ae954fa..87c7aa6 100644 --- a/PBGitIndex.m +++ b/PBGitIndex.m @@ -177,8 +177,13 @@ NSString *PBGitIndexOperationFailed = @"PBGitIndexOperationFailed"; int ret = 1; [self postCommitUpdate:@"Running hooks"]; - if (![repository executeHook:@"pre-commit" output:nil]) - return [self postCommitFailure:@"Pre-commit hook failed"]; + NSString *preCommitHookOutput = nil; + if (![repository executeHook:@"pre-commit" output:&preCommitHookOutput]) { + NSString *preCommitFailureMessage = [NSString stringWithFormat:@"Pre-commit hook failed%@%@", + [preCommitHookOutput length] > 0 ? @":\n" : @"", + preCommitHookOutput]; + return [self postCommitFailure:preCommitFailureMessage]; + } if (![repository executeHook:@"commit-msg" withArgs:[NSArray arrayWithObject:commitMessageFile] output:nil]) return [self postCommitFailure:@"Commit-msg hook failed"]; From ed833164d92fdd069c11272087ecbfce80c41584 Mon Sep 17 00:00:00 2001 From: Sebastian Staudt Date: Sun, 12 Sep 2010 14:30:11 +0200 Subject: [PATCH 02/14] Also display output of commit-msg hook --- PBGitIndex.m | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/PBGitIndex.m b/PBGitIndex.m index 87c7aa6..d39ce25 100644 --- a/PBGitIndex.m +++ b/PBGitIndex.m @@ -177,16 +177,23 @@ NSString *PBGitIndexOperationFailed = @"PBGitIndexOperationFailed"; int ret = 1; [self postCommitUpdate:@"Running hooks"]; - NSString *preCommitHookOutput = nil; - if (![repository executeHook:@"pre-commit" output:&preCommitHookOutput]) { - NSString *preCommitFailureMessage = [NSString stringWithFormat:@"Pre-commit hook failed%@%@", - [preCommitHookOutput length] > 0 ? @":\n" : @"", - preCommitHookOutput]; - return [self postCommitFailure:preCommitFailureMessage]; + NSString *hookFailureMessage = nil; + NSString *hookOutput = nil; + if (![repository executeHook:@"pre-commit" output:&hookOutput]) { + hookFailureMessage = [NSString stringWithFormat:@"Pre-commit hook failed%@%@", + [hookOutput length] > 0 ? @":\n" : @"", + hookOutput]; } - if (![repository executeHook:@"commit-msg" withArgs:[NSArray arrayWithObject:commitMessageFile] output:nil]) - return [self postCommitFailure:@"Commit-msg hook failed"]; + if (![repository executeHook:@"commit-msg" withArgs:[NSArray arrayWithObject:commitMessageFile] output:nil]) { + hookFailureMessage = [NSString stringWithFormat:@"Commit-msg hook failed%@%@", + [hookOutput length] > 0 ? @":\n" : @"", + hookOutput]; + } + + if (hookFailureMessage != nil) { + return [self postCommitFailure:hookFailureMessage]; + } commitMessage = [NSString stringWithContentsOfFile:commitMessageFile encoding:NSUTF8StringEncoding error:nil]; From 21d1f3989fd8132251430bbe238de92dab502bf3 Mon Sep 17 00:00:00 2001 From: Sebastian Staudt Date: Mon, 13 Sep 2010 09:16:25 +0200 Subject: [PATCH 03/14] 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. --- GitX.xcodeproj/project.pbxproj | 10 + PBCommitHookFailedSheet.h | 25 + PBCommitHookFailedSheet.m | 38 + PBCommitHookFailedSheet.xib | 1288 ++++++++++++++++++++++++++++++++ PBGitCommitController.h | 1 + PBGitCommitController.m | 24 +- PBGitIndex.h | 3 +- PBGitIndex.m | 45 +- PBGitWindowController.h | 3 +- PBGitWindowController.m | 6 + PBGitXMessageSheet.h | 1 + PBGitXMessageSheet.m | 2 - 12 files changed, 1424 insertions(+), 22 deletions(-) create mode 100644 PBCommitHookFailedSheet.h create mode 100644 PBCommitHookFailedSheet.m create mode 100644 PBCommitHookFailedSheet.xib diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index f95d9c4..71a441a 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -21,6 +21,8 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 02B41A5E123E307200DFC531 /* PBCommitHookFailedSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 02B41A5D123E307200DFC531 /* PBCommitHookFailedSheet.m */; }; + 02B41A60123E307F00DFC531 /* PBCommitHookFailedSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */; }; 056438B70ED0C40B00985397 /* DetailViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 056438B60ED0C40B00985397 /* DetailViewTemplate.png */; }; 3BC07F4C0ED5A5C5009A7768 /* HistoryViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 3BC07F4A0ED5A5C5009A7768 /* HistoryViewTemplate.png */; }; 3BC07F4D0ED5A5C5009A7768 /* CommitViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 3BC07F4B0ED5A5C5009A7768 /* CommitViewTemplate.png */; }; @@ -237,6 +239,9 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 02B41A5C123E307200DFC531 /* PBCommitHookFailedSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCommitHookFailedSheet.h; sourceTree = ""; }; + 02B41A5D123E307200DFC531 /* PBCommitHookFailedSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCommitHookFailedSheet.m; sourceTree = ""; }; + 02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PBCommitHookFailedSheet.xib; sourceTree = ""; }; 056438B60ED0C40B00985397 /* DetailViewTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DetailViewTemplate.png; path = Images/DetailViewTemplate.png; sourceTree = ""; }; 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; @@ -620,6 +625,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */, F5F7D0641062E7940072C81C /* UpdateKey.pem */, F50A41130EBB872D00208746 /* Widgets */, 47DBDB920E94F47200671A1E /* Preference Icons */, @@ -691,6 +697,8 @@ D82F435F111B9C6D00A25A39 /* Sheets */ = { isa = PBXGroup; children = ( + 02B41A5C123E307200DFC531 /* PBCommitHookFailedSheet.h */, + 02B41A5D123E307200DFC531 /* PBCommitHookFailedSheet.m */, D854948410D5C01B0083B917 /* PBCreateBranchSheet.h */, D854948510D5C01B0083B917 /* PBCreateBranchSheet.m */, D8E3B34B10DCA958001096A3 /* PBCreateTagSheet.h */, @@ -1172,6 +1180,7 @@ D8022FE811E124A0003C21F6 /* PBGitXMessageSheet.xib in Resources */, D8F01C4B12182F19007F729F /* GitX.sdef in Resources */, D8F4AB7912298CE200D6D53C /* rewindImage.pdf in Resources */, + 02B41A60123E307F00DFC531 /* PBCommitHookFailedSheet.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1321,6 +1330,7 @@ D8F01D531218A164007F729F /* NSApplication+GitXScripting.m in Sources */, D8B4DC571220D1E4004166D6 /* PBHistorySearchController.m in Sources */, D8712A00122B14EC00012334 /* GitXTextFieldCell.m in Sources */, + 02B41A5E123E307200DFC531 /* PBCommitHookFailedSheet.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/PBCommitHookFailedSheet.h b/PBCommitHookFailedSheet.h new file mode 100644 index 0000000..869d196 --- /dev/null +++ b/PBCommitHookFailedSheet.h @@ -0,0 +1,25 @@ +// +// PBCommitHookFailedSheet.h +// GitX +// +// Created by Sebastian Staudt on 9/12/10. +// Copyright 2010 Sebastian Staudt. All rights reserved. +// + +#import + +#import "PBGitCommitController.h" +#import "PBGitXMessageSheet.h" + + +@interface PBCommitHookFailedSheet : PBGitXMessageSheet +{ + PBGitCommitController *commitController; +} + ++ (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSString *)message infoText:(NSString *)info commitController:(PBGitCommitController *)controller; + +- (id)initWithWindowNibName:(NSString *)windowNibName andController:(PBGitCommitController *)controller; +- (IBAction)forceCommit:(id)sender; + +@end \ No newline at end of file diff --git a/PBCommitHookFailedSheet.m b/PBCommitHookFailedSheet.m new file mode 100644 index 0000000..907d85a --- /dev/null +++ b/PBCommitHookFailedSheet.m @@ -0,0 +1,38 @@ +// +// PBCommitHookFailedSheet.m +// GitX +// +// Created by Sebastian Staudt on 9/12/10. +// Copyright 2010 Sebastian Staudt. All rights reserved. +// + +#import "PBCommitHookFailedSheet.h" +#import "PBGitWindowController.h" + + +@implementation PBCommitHookFailedSheet + +#pragma mark - +#pragma mark PBCommitHookFailedSheet + ++ (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSString *)message infoText:(NSString *)info commitController:(PBGitCommitController *)controller +{ + PBCommitHookFailedSheet *sheet = [[self alloc] initWithWindowNibName:@"PBCommitHookFailedSheet" andController:controller]; + [sheet beginMessageSheetForWindow:parentWindow withMessageText:message infoText:info]; +} + +- (id)initWithWindowNibName:(NSString *)windowNibName andController:(PBGitCommitController *)controller; +{ + self = [self initWithWindowNibName:windowNibName]; + commitController = controller; + + return self; +} + +- (IBAction)forceCommit:(id)sender +{ + [self closeMessageSheet:self]; + [commitController forceCommit:sender]; +} + +@end diff --git a/PBCommitHookFailedSheet.xib b/PBCommitHookFailedSheet.xib new file mode 100644 index 0000000..60e58b1 --- /dev/null +++ b/PBCommitHookFailedSheet.xib @@ -0,0 +1,1288 @@ + + + + 1050 + 10F569 + 788 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 788 + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + PBCommitHookFailedSheet + + + FirstResponder + + + NSApplication + + + 1 + 2 + {{196, 331}, {540, 179}} + 544736256 + Window + NSWindow + + {1.79769e+308, 1.79769e+308} + + + 256 + + YES + + + 289 + {{430, 12}, {96, 32}} + + YES + + 67239424 + 134217728 + OK + + LucidaGrande + 13 + 1044 + + + -2038284033 + 129 + + DQ + 200 + 25 + + + + + 268 + + YES + + YES + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + NSFilenamesPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT TIFF v4.0 pasteboard type + + + {{17, 98}, {64, 64}} + + YES + + 130560 + 33554432 + + NSImage + NSApplicationIcon + + 0 + 0 + 0 + NO + + YES + + + + 266 + {{99, 142}, {424, 17}} + + YES + + 67239424 + 272629760 + <message> + + LucidaGrande-Bold + 13 + 16 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 274 + + YES + + + 2304 + + YES + + + 2322 + {423, 14} + + + + + + PGluZm8+A + + + YES + + YES + NSFont + NSParagraphStyle + + + YES + + Helvetica + 12 + 16 + + + 4 + + + + + + + + YES + + + 134 + + + + 423 + 1 + + + 2049 + 0 + + + 3 + MQA + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + 6 + System + selectedTextBackgroundColor + + + + 6 + System + selectedTextColor + + + + + + + YES + + YES + NSColor + NSCursor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + {8, -8} + 13 + + + + + + + 6 + {423, 1e+07} + {223, 0} + + + + {422, 72} + + + + + + {4, -5} + 1 + + 2 + + + + -2147483392 + {{386, 1}, {15, 163}} + + + _doScroller: + 1 + 0.85256409645080566 + + + + -2147483392 + {{-100, -100}, {87, 18}} + + YES + 1 + + _doScroller: + 1 + 0.94565218687057495 + + + {{98, 60}, {422, 72}} + + + 656 + + + + + + + 289 + {{289, 12}, {129, 32}} + + YES + + 67239424 + 134217728 + Force Commit + + + -2038284033 + 129 + + DQ + 200 + 25 + + + + {540, 179} + + + {{0, 0}, {1680, 1028}} + {1.79769e+308, 1.79769e+308} + + + + + YES + + + iconView + + + + 15 + + + + infoView + + + + 16 + + + + messageField + + + + 17 + + + + window + + + + 18 + + + + closeMessageSheet: + + + + 19 + + + + scrollView + + + + 20 + + + + forceCommit: + + + + 24 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 2 + + + YES + + + + + + + + + + 3 + + + YES + + + + + + 4 + + + + + 7 + + + YES + + + + + + 8 + + + + + 9 + + + YES + + + + + + 10 + + + + + 11 + + + YES + + + + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 21 + + + YES + + + + + + 22 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 2.IBPluginDependency + 2.IBUserGuides + 21.IBPluginDependency + 22.IBPluginDependency + 3.IBPluginDependency + 4.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{279, 244}, {540, 179}} + com.apple.InterfaceBuilder.CocoaPlugin + {{279, 244}, {540, 179}} + + {196, 240} + {{357, 418}, {480, 270}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + YES + + + 103 + 0 + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 24 + + + + YES + + PBCommitHookFailedSheet + PBGitXMessageSheet + + forceCommit: + id + + + forceCommit: + + forceCommit: + id + + + + IBProjectSource + PBCommitHookFailedSheet.h + + + + PBGitXMessageSheet + NSWindowController + + closeMessageSheet: + id + + + closeMessageSheet: + + closeMessageSheet: + id + + + + YES + + YES + iconView + infoView + messageField + scrollView + + + YES + NSImageView + NSTextView + NSTextField + NSScrollView + + + + YES + + YES + iconView + infoView + messageField + scrollView + + + YES + + iconView + NSImageView + + + infoView + NSTextView + + + messageField + NSTextField + + + scrollView + NSScrollView + + + + + IBProjectSource + PBGitXMessageSheet.h + + + + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSImageCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSImageCell.h + + + + NSImageView + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSImageView.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUAppcast.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUUpdater.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebEditingDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebFrameLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebJavaPlugIn.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPlugin.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPluginContainer.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPolicyDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebResourceLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebScriptObject.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebUIDelegate.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSScrollView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSScrollView.h + + + + NSScroller + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSScroller.h + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSTextView + NSText + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + NSWindowController + NSResponder + + showWindow: + id + + + showWindow: + + showWindow: + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + GitX.xcodeproj + 3 + + NSApplicationIcon + {128, 128} + + + diff --git a/PBGitCommitController.h b/PBGitCommitController.h index 0b39f05..ac852a3 100644 --- a/PBGitCommitController.h +++ b/PBGitCommitController.h @@ -29,5 +29,6 @@ - (IBAction) refresh:(id) sender; - (IBAction) commit:(id) sender; +- (IBAction) forceCommit:(id) sender; - (IBAction)signOff:(id)sender; @end diff --git a/PBGitCommitController.m b/PBGitCommitController.m index 02d74e1..9f0eca1 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -14,9 +14,11 @@ @interface PBGitCommitController () - (void)refreshFinished:(NSNotification *)notification; +- (void)commitWithVerification:(BOOL) doVerify; - (void)commitStatusUpdated:(NSNotification *)notification; - (void)commitFinished:(NSNotification *)notification; - (void)commitFailed:(NSNotification *)notification; +- (void)commitHookFailed:(NSNotification *)notification; - (void)amendCommit:(NSNotification *)notification; - (void)indexChanged:(NSNotification *)notification; - (void)indexOperationFailed:(NSNotification *)notification; @@ -38,6 +40,7 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(commitStatusUpdated:) name:PBGitIndexCommitStatus object:index]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(commitFinished:) name:PBGitIndexFinishedCommit object:index]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(commitFailed:) name:PBGitIndexCommitFailed object:index]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(commitHookFailed:) name:PBGitIndexCommitHookFailed object:index]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(amendCommit:) name:PBGitIndexAmendMessageAvailable object:index]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(indexChanged:) name:PBGitIndexIndexUpdated object:index]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(indexOperationFailed:) name:PBGitIndexOperationFailed object:index]; @@ -106,6 +109,16 @@ } - (IBAction) commit:(id) sender +{ + [self commitWithVerification:YES]; +} + +- (IBAction) forceCommit:(id) sender +{ + [self commitWithVerification:NO]; +} + +- (void) commitWithVerification:(BOOL) doVerify { if ([[NSFileManager defaultManager] fileExistsAtPath:[repository.fileURL.path stringByAppendingPathComponent:@"MERGE_HEAD"]]) { [[repository windowController] showMessageSheet:@"Cannot commit merges" infoText:@"GitX cannot commit merges yet. Please commit your changes from the command line."]; @@ -129,7 +142,7 @@ self.isBusy = YES; [commitMessageView setEditable:NO]; - [index commitWithMessage:commitMessage]; + [index commitWithMessage:commitMessage andVerify:doVerify]; } @@ -161,6 +174,15 @@ [[repository windowController] showMessageSheet:@"Commit failed" infoText:reason]; } +- (void)commitHookFailed:(NSNotification *)notification +{ + self.isBusy = NO; + NSString *reason = [[notification userInfo] objectForKey:@"description"]; + self.status = [@"Commit hook failed: " stringByAppendingString:reason]; + [commitMessageView setEditable:YES]; + [[repository windowController] showCommitHookFailedSheet:@"Commit hook failed" infoText:reason commitController:self]; +} + - (void)amendCommit:(NSNotification *)notification { // Replace commit message with the old one if it's less than 3 characters long. diff --git a/PBGitIndex.h b/PBGitIndex.h index 7ca1db7..dee0651 100644 --- a/PBGitIndex.h +++ b/PBGitIndex.h @@ -26,6 +26,7 @@ extern NSString *PBGitIndexIndexUpdated; // Committing files extern NSString *PBGitIndexCommitStatus; extern NSString *PBGitIndexCommitFailed; +extern NSString *PBGitIndexCommitHookFailed; extern NSString *PBGitIndexFinishedCommit; // Changing to amend @@ -66,7 +67,7 @@ extern NSString *PBGitIndexOperationFailed; // Refresh the index - (void)refresh; -- (void)commitWithMessage:(NSString *)commitMessage; +- (void)commitWithMessage:(NSString *)commitMessage andVerify:(BOOL) doVerify; // Inter-file changes: - (BOOL)stageFiles:(NSArray *)stageFiles; diff --git a/PBGitIndex.m b/PBGitIndex.m index d39ce25..e41e5e5 100644 --- a/PBGitIndex.m +++ b/PBGitIndex.m @@ -21,6 +21,7 @@ NSString *PBGitIndexIndexUpdated = @"GBGitIndexIndexUpdated"; NSString *PBGitIndexCommitStatus = @"PBGitIndexCommitStatus"; NSString *PBGitIndexCommitFailed = @"PBGitIndexCommitFailed"; +NSString *PBGitIndexCommitHookFailed = @"PBGitIndexCommitHookFailed"; NSString *PBGitIndexFinishedCommit = @"PBGitIndexFinishedCommit"; NSString *PBGitIndexAmendMessageAvailable = @"PBGitIndexAmendMessageAvailable"; @@ -48,6 +49,7 @@ NSString *PBGitIndexOperationFailed = @"PBGitIndexOperationFailed"; - (NSString *) parentTree; - (void)postCommitUpdate:(NSString *)update; - (void)postCommitFailure:(NSString *)reason; +- (void)postCommitHookFailure:(NSString *)reason; - (void)postIndexChange; - (void)postOperationFailed:(NSString *)description; @end @@ -145,7 +147,7 @@ NSString *PBGitIndexOperationFailed = @"PBGitIndexOperationFailed"; } // TODO: make Asynchronous -- (void)commitWithMessage:(NSString *)commitMessage +- (void)commitWithMessage:(NSString *)commitMessage andVerify:(BOOL) doVerify { NSMutableString *commitSubject = [@"commit: " mutableCopy]; NSRange newLine = [commitMessage rangeOfString:@"\n"]; @@ -176,23 +178,25 @@ NSString *PBGitIndexOperationFailed = @"PBGitIndexOperationFailed"; [self postCommitUpdate:@"Creating commit"]; int ret = 1; - [self postCommitUpdate:@"Running hooks"]; - NSString *hookFailureMessage = nil; - NSString *hookOutput = nil; - if (![repository executeHook:@"pre-commit" output:&hookOutput]) { - hookFailureMessage = [NSString stringWithFormat:@"Pre-commit hook failed%@%@", - [hookOutput length] > 0 ? @":\n" : @"", - hookOutput]; - } - - if (![repository executeHook:@"commit-msg" withArgs:[NSArray arrayWithObject:commitMessageFile] output:nil]) { - hookFailureMessage = [NSString stringWithFormat:@"Commit-msg hook failed%@%@", - [hookOutput length] > 0 ? @":\n" : @"", - hookOutput]; - } + if (doVerify) { + [self postCommitUpdate:@"Running hooks"]; + NSString *hookFailureMessage = nil; + NSString *hookOutput = nil; + if (![repository executeHook:@"pre-commit" output:&hookOutput]) { + hookFailureMessage = [NSString stringWithFormat:@"Pre-commit hook failed%@%@", + [hookOutput length] > 0 ? @":\n" : @"", + hookOutput]; + } - if (hookFailureMessage != nil) { - return [self postCommitFailure:hookFailureMessage]; + if (![repository executeHook:@"commit-msg" withArgs:[NSArray arrayWithObject:commitMessageFile] output:nil]) { + hookFailureMessage = [NSString stringWithFormat:@"Commit-msg hook failed%@%@", + [hookOutput length] > 0 ? @":\n" : @"", + hookOutput]; + } + + if (hookFailureMessage != nil) { + return [self postCommitHookFailure:hookFailureMessage]; + } } commitMessage = [NSString stringWithContentsOfFile:commitMessageFile encoding:NSUTF8StringEncoding error:nil]; @@ -254,6 +258,13 @@ NSString *PBGitIndexOperationFailed = @"PBGitIndexOperationFailed"; userInfo:[NSDictionary dictionaryWithObject:reason forKey:@"description"]]; } +- (void)postCommitHookFailure:(NSString *)reason +{ + [[NSNotificationCenter defaultCenter] postNotificationName:PBGitIndexCommitHookFailed + object:self + userInfo:[NSDictionary dictionaryWithObject:reason forKey:@"description"]]; +} + - (void)postOperationFailed:(NSString *)description { [[NSNotificationCenter defaultCenter] postNotificationName:PBGitIndexOperationFailed diff --git a/PBGitWindowController.h b/PBGitWindowController.h index 29f5245..0f38e22 100644 --- a/PBGitWindowController.h +++ b/PBGitWindowController.h @@ -9,7 +9,7 @@ #import #import "PBGitRepository.h" -@class PBViewController, PBGitSidebarController; +@class PBViewController, PBGitSidebarController, PBGitCommitController; @interface PBGitWindowController : NSWindowController { __weak PBGitRepository* repository; @@ -37,6 +37,7 @@ - (void)changeContentController:(PBViewController *)controller; +- (void)showCommitHookFailedSheet:(NSString *)messageText infoText:(NSString *)infoText commitController:(PBGitCommitController *)controller; - (void)showMessageSheet:(NSString *)messageText infoText:(NSString *)infoText; - (void)showErrorSheet:(NSError *)error; - (void)showErrorSheetTitle:(NSString *)title message:(NSString *)message arguments:(NSArray *)arguments output:(NSString *)output; diff --git a/PBGitWindowController.m b/PBGitWindowController.m index 1968c48..9fb9c13 100644 --- a/PBGitWindowController.m +++ b/PBGitWindowController.m @@ -11,6 +11,7 @@ #import "PBGitCommitController.h" #import "Terminal.h" #import "PBCloneRepsitoryToSheet.h" +#import "PBCommitHookFailedSheet.h" #import "PBGitXMessageSheet.h" #import "PBGitSidebarController.h" @@ -109,6 +110,11 @@ [sidebarController selectCurrentBranch]; } +- (void)showCommitHookFailedSheet:(NSString *)messageText infoText:(NSString *)infoText commitController:(PBGitCommitController *)controller +{ + [PBCommitHookFailedSheet beginMessageSheetForWindow:[self window] withMessageText:messageText infoText:infoText commitController:controller]; +} + - (void)showMessageSheet:(NSString *)messageText infoText:(NSString *)infoText { [PBGitXMessageSheet beginMessageSheetForWindow:[self window] withMessageText:messageText infoText:infoText]; diff --git a/PBGitXMessageSheet.h b/PBGitXMessageSheet.h index 440cf01..60cd3c7 100644 --- a/PBGitXMessageSheet.h +++ b/PBGitXMessageSheet.h @@ -21,6 +21,7 @@ + (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withError:(NSError *)error; +- (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSString *)message infoText:(NSString *)info; - (IBAction)closeMessageSheet:(id)sender; diff --git a/PBGitXMessageSheet.m b/PBGitXMessageSheet.m index 5c8441c..783cc94 100644 --- a/PBGitXMessageSheet.m +++ b/PBGitXMessageSheet.m @@ -14,8 +14,6 @@ @interface PBGitXMessageSheet () -- (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSString *)message infoText:(NSString *)info; - - (void)setInfoString:(NSString *)info; - (void)resizeWindow; From f4a6d3fe0b9a8d2718365161263bf4447e0b3503 Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Fri, 17 Sep 2010 23:45:19 -0600 Subject: [PATCH 04/14] Set the working directory for arguments sent from the cli This allows running the gitx cli in a subdirectory and specifying file paths in that directory without having to type out the full path. --- PBGitRepository.m | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/PBGitRepository.m b/PBGitRepository.m index 9d7862c..cd1e143 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -905,7 +905,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; #pragma mark GitX Scripting -- (void)handleRevListArguments:(NSArray *)arguments +- (void)handleRevListArguments:(NSArray *)arguments inWorkingDirectory:(NSURL *)workingDirectory { if (![arguments count]) return; @@ -915,19 +915,23 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; // the argument may be a branch or tag name but will probably not be the full reference if ([arguments count] == 1) { PBGitRef *refArgument = [self refForName:[arguments lastObject]]; - if (refArgument) + if (refArgument) { revListSpecifier = [[PBGitRevSpecifier alloc] initWithRef:refArgument]; + revListSpecifier.workingDirectory = workingDirectory; + } } - if (!revListSpecifier) + if (!revListSpecifier) { revListSpecifier = [[PBGitRevSpecifier alloc] initWithParameters:arguments]; + revListSpecifier.workingDirectory = workingDirectory; + } self.currentBranch = [self addBranch:revListSpecifier]; [PBGitDefaults setShowStageView:NO]; [self.windowController showHistoryView:self]; } -- (void)handleBranchFilterEventForFilter:(PBGitXBranchFilterType)filter additionalArguments:(NSMutableArray *)arguments +- (void)handleBranchFilterEventForFilter:(PBGitXBranchFilterType)filter additionalArguments:(NSMutableArray *)arguments inWorkingDirectory:(NSURL *)workingDirectory { self.currentBranchFilter = filter; [PBGitDefaults setShowStageView:NO]; @@ -936,11 +940,11 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; // treat any additional arguments as a rev-list specifier if ([arguments count] > 1) { [arguments removeObjectAtIndex:0]; - [self handleRevListArguments:arguments]; + [self handleRevListArguments:arguments inWorkingDirectory:workingDirectory]; } } -- (void)handleGitXScriptingArguments:(NSAppleEventDescriptor *)argumentsList +- (void)handleGitXScriptingArguments:(NSAppleEventDescriptor *)argumentsList inWorkingDirectory:(NSURL *)workingDirectory { NSMutableArray *arguments = [NSMutableArray array]; uint argumentsIndex = 1; // AppleEvent list descriptor's are one based @@ -964,22 +968,22 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; } if ([firstArgument isEqualToString:@"--all"]) { - [self handleBranchFilterEventForFilter:kGitXAllBranchesFilter additionalArguments:arguments]; + [self handleBranchFilterEventForFilter:kGitXAllBranchesFilter additionalArguments:arguments inWorkingDirectory:workingDirectory]; return; } if ([firstArgument isEqualToString:@"--local"]) { - [self handleBranchFilterEventForFilter:kGitXLocalRemoteBranchesFilter additionalArguments:arguments]; + [self handleBranchFilterEventForFilter:kGitXLocalRemoteBranchesFilter additionalArguments:arguments inWorkingDirectory:workingDirectory]; return; } if ([firstArgument isEqualToString:@"--branch"]) { - [self handleBranchFilterEventForFilter:kGitXSelectedBranchFilter additionalArguments:arguments]; + [self handleBranchFilterEventForFilter:kGitXSelectedBranchFilter additionalArguments:arguments inWorkingDirectory:workingDirectory]; return; } // if the argument is not a known command then treat it as a rev-list specifier - [self handleRevListArguments:arguments]; + [self handleRevListArguments:arguments inWorkingDirectory:workingDirectory]; } // see if the current appleEvent has the command line arguments from the gitx cli @@ -996,9 +1000,10 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; // on app launch there may be many repositories opening, so double check that this is the right repo NSString *path = [[eventRecord paramDescriptorForKeyword:typeFileURL] stringValue]; if (path) { - if ([[PBGitRepository gitDirForURL:[NSURL URLWithString:path]] isEqual:[self fileURL]]) { + NSURL *workingDirectory = [NSURL URLWithString:path]; + if ([[PBGitRepository gitDirForURL:workingDirectory] isEqual:[self fileURL]]) { NSAppleEventDescriptor *argumentsList = [eventRecord paramDescriptorForKeyword:kGitXAEKeyArgumentsList]; - [self handleGitXScriptingArguments:argumentsList]; + [self handleGitXScriptingArguments:argumentsList inWorkingDirectory:workingDirectory]; // showWindows may be called more than once during app launch so remove the CLI data after we handle the event [currentAppleEvent removeDescriptorWithKeyword:keyAEPropData]; From 2852ecbf01b29fe85ad505910aa6a5ae54c98807 Mon Sep 17 00:00:00 2001 From: Johannes Gilger Date: Sun, 12 Sep 2010 15:46:15 +0200 Subject: [PATCH 05/14] History: Correctly wrap lots of tags When there are many tags in a commit we want them to wrap. This fixes lighthouse ticket #220. Signed-off-by: Johannes Gilger --- html/views/history/history.css | 2 +- html/views/history/history.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/html/views/history/history.css b/html/views/history/history.css index 21e939c..f2b694a 100644 --- a/html/views/history/history.css +++ b/html/views/history/history.css @@ -130,7 +130,7 @@ a.showdiff { font-size: 9px; font-family: Helvetica; border: 1px solid black; - margin-right: 5px; + margin-right: 2px; padding: 1px 3px 1px 3px; -webkit-border-radius: 2px; } diff --git a/html/views/history/history.js b/html/views/history/history.js index ca970fb..b9520ca 100644 --- a/html/views/history/history.js +++ b/html/views/history/history.js @@ -161,7 +161,7 @@ var showRefs = function() { refs.innerHTML = ""; for (var i = 0; i < commit.refs.length; i++) { var ref = commit.refs[i]; - refs.innerHTML += '' + ref.shortName() + ''; + refs.innerHTML += '' + ref.shortName() + ' '; } } else refs.parentNode.style.display = "none"; From f2cf4381799b25c55aed0c1fd9d36d58a89af272 Mon Sep 17 00:00:00 2001 From: Johannes Gilger Date: Sun, 12 Sep 2010 17:10:47 +0200 Subject: [PATCH 06/14] History-View: Clear list of files on showDiff This clears the list of files before redrawing the showDiff method. Fixes Lighthouse ticket #263 Signed-off-by: Johannes Gilger --- html/views/history/history.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/html/views/history/history.js b/html/views/history/history.js index b9520ca..c0ac4c6 100644 --- a/html/views/history/history.js +++ b/html/views/history/history.js @@ -219,6 +219,8 @@ var loadCommit = function(commitObject, currentRef) { var showDiff = function() { + $("files").innerHTML = ""; + // Callback for the diff highlighter. Used to generate a filelist var newfile = function(name1, name2, id, mode_change, old_mode, new_mode) { var img = document.createElement("img"); From 95b48779e84f87ee2c586f2e35f8adcbaa1bba82 Mon Sep 17 00:00:00 2001 From: Johannes Gilger Date: Sun, 12 Sep 2010 17:40:27 +0200 Subject: [PATCH 07/14] Diff-View: Honor whitespace preference This honors the preferences for showing differences in whitespacing when using diff between single revisions/branches. Signed-off-by: Johannes Gilger --- PBDiffWindowController.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PBDiffWindowController.m b/PBDiffWindowController.m index 496c850..06403d5 100644 --- a/PBDiffWindowController.m +++ b/PBDiffWindowController.m @@ -9,6 +9,7 @@ #import "PBDiffWindowController.h" #import "PBGitRepository.h" #import "PBGitCommit.h" +#import "PBGitDefaults.h" @implementation PBDiffWindowController @@ -34,6 +35,10 @@ NSString *commitSelector = [NSString stringWithFormat:@"%@..%@", [startCommit realSha], [diffCommit realSha]]; NSMutableArray *arguments = [NSMutableArray arrayWithObjects:@"diff", commitSelector, nil]; + + if (![PBGitDefaults showWhitespaceDifferences]) + [arguments insertObject:@"-w" atIndex:1]; + if (filePaths) { [arguments addObject:@"--"]; [arguments addObjectsFromArray:filePaths]; From 5194d5c5c98d881ca40041e059ae5e6f6bfbb7a0 Mon Sep 17 00:00:00 2001 From: Johannes Gilger Date: Sun, 12 Sep 2010 19:34:03 +0200 Subject: [PATCH 08/14] History: Show author/committer according to .mailmap This does not affect the display of the diff, since it is done with git show --pretty=raw. Signed-off-by: Johannes Gilger --- PBGitRevList.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PBGitRevList.mm b/PBGitRevList.mm index 851d6ed..8ab64e1 100644 --- a/PBGitRevList.mm +++ b/PBGitRevList.mm @@ -102,7 +102,7 @@ using namespace std; std::map encodingMap; NSThread *currentThread = [NSThread currentThread]; - NSString *formatString = @"--pretty=format:%H\01%e\01%an\01%cn\01%s\01%P\01%at"; + NSString *formatString = @"--pretty=format:%H\01%e\01%aN\01%cN\01%s\01%P\01%at"; BOOL showSign = [rev hasLeftRight]; if (showSign) From 9a9de9577c6af02c8ea88c9d33a23f428347a430 Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Sat, 18 Sep 2010 19:14:35 -0600 Subject: [PATCH 09/14] Bugfix: crasher on 10.5 due to webkit and the + + Gist it + From 6f83f2382cb4e02b205b19d7bb0ba09b505f4ded Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Sun, 19 Sep 2010 10:51:03 -0600 Subject: [PATCH 10/14] Bugfix: Rebasing the head ref Only use the ref being rebased onto otherwise git will create a detached HEAD. --- PBGitHistoryController.m | 6 ++---- PBRefController.m | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m index c61a464..a8bf5ac 100644 --- a/PBGitHistoryController.m +++ b/PBGitHistoryController.m @@ -671,10 +671,8 @@ - (IBAction) rebase:(id)sender { - if (selectedCommit) { - PBGitRef *headRef = [[repository headRef] ref]; - [repository rebaseBranch:headRef onRefish:selectedCommit]; - } + if (selectedCommit) + [repository rebaseBranch:nil onRefish:selectedCommit]; } #pragma mark - diff --git a/PBRefController.m b/PBRefController.m index 1b07f00..c9b8c2e 100644 --- a/PBRefController.m +++ b/PBRefController.m @@ -147,9 +147,8 @@ - (void) rebaseHeadBranch:(PBRefMenuItem *)sender { id refish = [sender refish]; - PBGitRef *headRef = [[historyController.repository headRef] ref]; - [historyController.repository rebaseBranch:headRef onRefish:refish]; + [historyController.repository rebaseBranch:nil onRefish:refish]; } From 929f9fc0f59389f422c280333dbdd41b2844b42e Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Sun, 19 Sep 2010 12:46:13 -0600 Subject: [PATCH 11/14] Show the branch that will be tracked when creating a tracking branch --- PBRefMenuItem.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PBRefMenuItem.m b/PBRefMenuItem.m index 4b47fdc..cfbe710 100644 --- a/PBRefMenuItem.m +++ b/PBRefMenuItem.m @@ -59,7 +59,8 @@ [items addObject:[PBRefMenuItem separatorItem]]; // create branch - [items addObject:[PBRefMenuItem itemWithTitle:@"Create branch…" action:@selector(createBranch:) enabled:YES]]; + NSString *createBranchTitle = [ref isRemoteBranch] ? [NSString stringWithFormat:@"Create branch that tracks %@…", targetRefName] : @"Create branch…"; + [items addObject:[PBRefMenuItem itemWithTitle:createBranchTitle action:@selector(createBranch:) enabled:YES]]; // create tag [items addObject:[PBRefMenuItem itemWithTitle:@"Create Tag…" action:@selector(createTag:) enabled:YES]]; From e388434a493b74386fbefdbab0f9c57f51004fe2 Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Sun, 19 Sep 2010 12:47:06 -0600 Subject: [PATCH 12/14] When creating a tracking branch pre-fill the branch name in the create branch sheet --- PBCreateBranchSheet.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PBCreateBranchSheet.m b/PBCreateBranchSheet.m index ebd2643..0eb8d2a 100644 --- a/PBCreateBranchSheet.m +++ b/PBCreateBranchSheet.m @@ -51,6 +51,16 @@ [self.errorMessageField setStringValue:@""]; self.shouldCheckoutBranch = [PBGitDefaults shouldCheckoutBranch]; + // when creating a local branch tracking a remote branch preset the branch name to the name of the remote branch + if ([self.startRefish refishType] == kGitXRemoteBranchType) { + NSMutableArray *components = [[[self.startRefish shortName] componentsSeparatedByString:@"/"] mutableCopy]; + if ([components count] > 1) { + [components removeObjectAtIndex:0]; + NSString *branchName = [components componentsJoinedByString:@"/"]; + [self.branchNameField setStringValue:branchName]; + } + } + [NSApp beginSheet:[self window] modalForWindow:[self.repository.windowController window] modalDelegate:self didEndSelector:nil contextInfo:NULL]; } From d00dbe42b3c03d69164426e36418c9dba5552ae0 Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Sun, 19 Sep 2010 14:31:30 -0600 Subject: [PATCH 13/14] Always pull all tracking branches from the remote 'git pull remote branch' will not update the remote's tracking branches, only the selected local branch. It may not be readily apparent that this happened. So remove the cases where GitX would pull just a single branch and always pull all the tracking branches. The current checked out branch will still be updated as normal. --- PBGitRepository.m | 19 +------------------ PBRefMenuItem.m | 3 +-- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/PBGitRepository.m b/PBGitRepository.m index cd1e143..3d4489b 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -625,24 +625,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; NSString *remoteName = [remoteRef remoteName]; [arguments addObject:remoteName]; - NSString *branchName = nil; - NSString *refSpec = nil; - if ([ref isRemoteBranch]) { - branchName = [ref shortName]; - refSpec = [ref remoteBranchName]; - } - else if ([ref isRemote] || !ref) { - branchName = @"all tracking branches"; - } - else { - branchName = [ref shortName]; - refSpec = [NSString stringWithFormat:@"%@:%@", branchName, branchName]; - } - if (refSpec) - [arguments addObject:refSpec]; - - NSString *headRefName = [[[self headRef] ref] shortName]; - NSString *description = [NSString stringWithFormat:@"Pulling %@ from %@ and updating %@", branchName, remoteName, headRefName]; + NSString *description = [NSString stringWithFormat:@"Pulling all tracking branches from %@", remoteName]; NSString *title = @"Pulling from remote"; [PBRemoteProgressSheet beginRemoteProgressSheetForArguments:arguments title:title description:description inRepository:self]; } diff --git a/PBRefMenuItem.m b/PBRefMenuItem.m index cfbe710..083de7b 100644 --- a/PBRefMenuItem.m +++ b/PBRefMenuItem.m @@ -90,8 +90,7 @@ [items addObject:[PBRefMenuItem itemWithTitle:fetchTitle action:@selector(fetchRemote:) enabled:hasRemote]]; // pull - NSString *pullRemoteName = [ref isRemoteBranch] ? [ref shortName] : remoteName; - NSString *pullTitle = hasRemote ? [NSString stringWithFormat:@"Pull %@ and update %@", pullRemoteName, headRefName] : @"Pull"; + NSString *pullTitle = hasRemote ? [NSString stringWithFormat:@"Pull %@ and update %@", remoteName, headRefName] : @"Pull"; [items addObject:[PBRefMenuItem itemWithTitle:pullTitle action:@selector(pullRemote:) enabled:hasRemote]]; // push From 59c4983b5125a6ac27d961a20ab27f59fa1f3155 Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Mon, 20 Sep 2010 22:36:06 -0600 Subject: [PATCH 14/14] Bugfix: only exit the handleSTDINDiff() if there is an actual diff --- gitx.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gitx.m b/gitx.m index 05f2aa8..3230d01 100644 --- a/gitx.m +++ b/gitx.m @@ -120,9 +120,8 @@ void handleSTDINDiff() if (diff && [diff length] > 0) { GitXApplication *gitXApp = [SBApplication applicationWithBundleIdentifier:kGitXBundleIdentifier]; [gitXApp showDiff:diff]; + exit(0); } - - exit(0); } void handleDiffWithArguments(NSURL *repositoryURL, NSMutableArray *arguments)