From d40af770f79d96422e6722cf76f6ffdbde417406 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Tue, 28 Apr 2009 16:31:45 +0100 Subject: [PATCH 1/6] ChangesTableView: Remove warning by casting to correct class --- PBFileChangesTableView.m | 3 ++- PBGitIndexController.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/PBFileChangesTableView.m b/PBFileChangesTableView.m index 4f489e1..3bded2e 100644 --- a/PBFileChangesTableView.m +++ b/PBFileChangesTableView.m @@ -7,6 +7,7 @@ // #import "PBFileChangesTableView.h" +#import "PBGitIndexController.h" @implementation PBFileChangesTableView @@ -14,7 +15,7 @@ - (NSMenu *)menuForEvent:(NSEvent *)theEvent { if ([self delegate]) - return [[self delegate] menuForTable: self]; + return [(PBGitIndexController *)[self delegate] menuForTable: self]; return nil; } diff --git a/PBGitIndexController.h b/PBGitIndexController.h index ca1c4fd..a3bc191 100644 --- a/PBGitIndexController.h +++ b/PBGitIndexController.h @@ -35,4 +35,6 @@ - (NSString *) stagedChangesForFile:(PBChangedFile *)file; - (NSString *) unstagedChangesForFile:(PBChangedFile *)file; + +- (NSMenu *) menuForTable:(NSTableView *)table; @end From 91c11358f116453f9799c4879eab619f15cec865 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Tue, 28 Apr 2009 16:38:54 +0100 Subject: [PATCH 2/6] IndexController: Add methods to stop tracking the Index This is useful when changing large portions of the index at once, as refreshing the tables in those cases can become a large burden. --- PBGitIndexController.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/PBGitIndexController.m b/PBGitIndexController.m index a89d70f..6b36925 100644 --- a/PBGitIndexController.m +++ b/PBGitIndexController.m @@ -12,6 +12,11 @@ #define FileChangesTableViewType @"GitFileChangedType" +@interface PBGitIndexController (PrivateMethods) +- (void)stopTrackingIndex; +- (void)resumeTrackingIndex; +@end + @implementation PBGitIndexController @synthesize contextSize; @@ -386,4 +391,17 @@ writeRowsWithIndexes:(NSIndexSet *)rowIndexes return NO; } +#pragma mark Private Methods +- (void)stopTrackingIndex +{ + [stagedFilesController setAutomaticallyRearrangesObjects:NO]; + [unstagedFilesController setAutomaticallyRearrangesObjects:NO]; +} +- (void)resumeTrackingIndex +{ + [stagedFilesController setAutomaticallyRearrangesObjects:YES]; + [unstagedFilesController setAutomaticallyRearrangesObjects:YES]; + [stagedFilesController rearrangeObjects]; + [unstagedFilesController rearrangeObjects]; +} @end From aeb5c4d8e1fd2ae41802138d8af4b23578d21514 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Tue, 28 Apr 2009 16:34:13 +0100 Subject: [PATCH 3/6] IndexController: Temporarily stop tracking when (un)staging This uses the new way to stop tracking the index when adding files. This can be noticed when staging more than one file, as the tables might have to refresh dozens of times. --- PBGitIndexController.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PBGitIndexController.m b/PBGitIndexController.m index 6b36925..f883d56 100644 --- a/PBGitIndexController.m +++ b/PBGitIndexController.m @@ -54,11 +54,13 @@ return; } + [self stopTrackingIndex]; for (PBChangedFile *file in files) { file.hasUnstagedChanges = NO; file.hasCachedChanges = YES; } + [self resumeTrackingIndex]; } - (void) unstageFiles:(NSArray *)files @@ -78,12 +80,14 @@ NSLog(@"Error when updating index. Retvalue: %i", ret); return; } - + + [self stopTrackingIndex]; for (PBChangedFile *file in files) { file.hasUnstagedChanges = YES; file.hasCachedChanges = NO; } + [self resumeTrackingIndex]; } - (void) ignoreFiles:(NSArray *)files From 988b105455f65e10bf715af20c4124c5763c7cd6 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 28 Apr 2009 19:17:04 +0200 Subject: [PATCH 4/6] Fix compilation with GCC 4.2 Also compiles fine with LLVM-GCC. --- PBGitLane.h | 2 +- PBGitRevisionCell.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PBGitLane.h b/PBGitLane.h index 2a1dcd9..57d59c8 100644 --- a/PBGitLane.h +++ b/PBGitLane.h @@ -33,7 +33,7 @@ public: d_index = s_colorIndex++; } - bool PBGitLane::isCommit(git_oid *sha) const + bool isCommit(git_oid *sha) const { return !git_oid_cmp(&d_sha, sha); } diff --git a/PBGitRevisionCell.h b/PBGitRevisionCell.h index 57478bb..d6aa4ed 100644 --- a/PBGitRevisionCell.h +++ b/PBGitRevisionCell.h @@ -13,7 +13,7 @@ #import "PBRefContextDelegate.h" @interface PBGitRevisionCell : NSActionCell { - id objectValue; + PBGitCommit *objectValue; PBGraphCellInfo *cellInfo; NSTextFieldCell *textCell; IBOutlet PBGitHistoryController *controller; From c6fbcccc025f6c18b9b8964b63835294f7dd8620 Mon Sep 17 00:00:00 2001 From: Arjen Laarhoven Date: Wed, 1 Apr 2009 21:10:42 +0200 Subject: [PATCH 5/6] GitX.xcodeproj: Quote paths in custom shell scripts Properly quote the TARGET_BUILD_DIR variable in the script to prevent failure when the project path contains spaces. --- GitX.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index 69b4dbf..178e092 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -757,7 +757,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`$TARGET_BUILD_DIR/gitx --git-path`\nVERSION=$(git describe)\nLONG_VERSION=$(echo $VERSION | sed -e \"s/\\-/\\./\" -e \"s/^v//\" -e \"s/-.*//\")\nSHORT_VERSION=$(echo $VERSION | sed -e \"s/\\-.*//\" -e \"s/^v//\")\n\necho -n \"#define LONG_VERSION $LONG_VERSION\n#define SHORT_VERSION $SHORT_VERSION\" > build/revision\ntouch Info.plist"; + shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`\"$TARGET_BUILD_DIR\"/gitx --git-path`\nVERSION=$(git describe)\nLONG_VERSION=$(echo $VERSION | sed -e \"s/\\-/\\./\" -e \"s/^v//\" -e \"s/-.*//\")\nSHORT_VERSION=$(echo $VERSION | sed -e \"s/\\-.*//\" -e \"s/^v//\")\n\necho -n \"#define LONG_VERSION $LONG_VERSION\n#define SHORT_VERSION $SHORT_VERSION\" > build/revision\ntouch Info.plist"; }; F5792DFB0EDB570C001B0C31 /* Compile libgit2 */ = { isa = PBXShellScriptBuildPhase; @@ -771,7 +771,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`$TARGET_BUILD_DIR/gitx --git-path`\ngit submodule init\ngit submodule update\ncd libgit2\nrm -f libgit2.a\nmake CFLAGS=\"-arch i386 -arch ppc\"\nranlib libgit2.a"; + shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`\"$TARGET_BUILD_DIR\"/gitx --git-path`\ngit submodule init\ngit submodule update\ncd libgit2\nrm -f libgit2.a\nmake CFLAGS=\"-arch i386 -arch ppc\"\nranlib libgit2.a"; }; F5CF04A20EAE696C00D75C81 /* Copy HTML files */ = { isa = PBXShellScriptBuildPhase; From 6dcefe5bec67a1cac13d3d9a39858cbf02bf8307 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 1 May 2009 00:46:15 +0200 Subject: [PATCH 6/6] Fix many gcc 4.2 compiler warnings --- PBGitCommitController.m | 5 +++-- PBGitIndexController.m | 6 +++--- PBIconAndTextCell.mm | 2 +- PBQLOutlineView.m | 4 ++-- PBRefController.m | 10 +++++----- PBRepositoryDocumentController.m | 2 +- PBWebDiffController.m | 4 ++-- PBWebHistoryController.m | 4 ++-- 8 files changed, 19 insertions(+), 18 deletions(-) diff --git a/PBGitCommitController.m b/PBGitCommitController.m index 03b6a76..315da43 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -9,6 +9,7 @@ #import "PBGitCommitController.h" #import "NSFileHandleExt.h" #import "PBChangedFile.h" +#import "PBWebChangesController.h" @implementation PBGitCommitController @@ -33,7 +34,7 @@ } - (void) removeView { - [webController closeView]; + [(PBWebChangesController *)webController closeView]; [super finalize]; } @@ -315,7 +316,7 @@ if (ret) return [self commitFailedBecause:@"Could not update HEAD"]; - [webController setStateMessage:[NSString stringWithFormat:@"Successfully created commit %@", commit]]; + [(PBWebChangesController *)webController setStateMessage:[NSString stringWithFormat:@"Successfully created commit %@", commit]]; repository.hasChanged = YES; self.busy--; diff --git a/PBGitIndexController.m b/PBGitIndexController.m index f883d56..e69dc39 100644 --- a/PBGitIndexController.m +++ b/PBGitIndexController.m @@ -301,7 +301,7 @@ # pragma mark TableView icon delegate -- (void)tableView:(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(int)rowIndex +- (void)tableView:(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)rowIndex { id controller = [tableView tag] == 0 ? unstagedFilesController : stagedFilesController; [[tableColumn dataCell] setImage:[[[controller arrangedObjects] objectAtIndex:rowIndex] icon]]; @@ -353,7 +353,7 @@ writeRowsWithIndexes:(NSIndexSet *)rowIndexes - (NSDragOperation)tableView:(NSTableView*)tableView validateDrop:(id )info - proposedRow:(int)row + proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)operation { if ([info draggingSource] == tableView) @@ -365,7 +365,7 @@ writeRowsWithIndexes:(NSIndexSet *)rowIndexes - (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id )info - row:(int)row + row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation { NSPasteboard* pboard = [info draggingPasteboard]; diff --git a/PBIconAndTextCell.mm b/PBIconAndTextCell.mm index ba53a33..916655e 100644 --- a/PBIconAndTextCell.mm +++ b/PBIconAndTextCell.mm @@ -26,7 +26,7 @@ return cell; } -- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(int)selStart length:(int)selLength +- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart length:(NSInteger)selLength { NSRect textFrame, imageFrame; NSDivideRect (aRect, &imageFrame, &textFrame, 3 + [image size].width, NSMinXEdge); diff --git a/PBQLOutlineView.m b/PBQLOutlineView.m index c9b2d31..4e620bd 100644 --- a/PBQLOutlineView.m +++ b/PBQLOutlineView.m @@ -62,11 +62,11 @@ - (BOOL) outlineView: (NSOutlineView *)ov isItemExpandable: (id)item { return NO; } -- (int) outlineView: (NSOutlineView *)ov +- (NSInteger) outlineView: (NSOutlineView *)ov numberOfChildrenOfItem:(id)item { return 0; } - (id) outlineView: (NSOutlineView *)ov - child:(int)index + child:(NSInteger)index ofItem:(id)item { return nil; } - (id) outlineView: (NSOutlineView *)ov diff --git a/PBRefController.m b/PBRefController.m index 3f2c80a..ccd5abd 100644 --- a/PBRefController.m +++ b/PBRefController.m @@ -21,12 +21,12 @@ [self selectCurrentBranch]; } -- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(id)context +- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if ([context isEqualToString: @"branchChange"]) { + if ([(NSString *)context isEqualToString: @"branchChange"]) { [self updateBranchMenu]; } - else if ([context isEqualToString:@"currentBranchChange"]) { + else if ([(NSString *)context isEqualToString:@"currentBranchChange"]) { [self selectCurrentBranch]; } else { @@ -102,7 +102,7 @@ - (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id )info - proposedRow:(int)row + proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)operation { if (operation == NSTableViewDropAbove) @@ -117,7 +117,7 @@ - (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id )info - row:(int)row + row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation { if (operation != NSTableViewDropOn) diff --git a/PBRepositoryDocumentController.m b/PBRepositoryDocumentController.m index fdfae3a..83bd887 100644 --- a/PBRepositoryDocumentController.m +++ b/PBRepositoryDocumentController.m @@ -60,7 +60,7 @@ if ([op runModal] == NSFileHandlingPanelOKButton) { NSString *path = [op filename]; - NSInteger terminationStatus; + int terminationStatus; NSString *result = [PBEasyPipe outputForCommand:[PBGitBinary path] withArgs:[NSArray arrayWithObjects:@"init", @"-q", nil] inDir:path inputString:nil retValue:&terminationStatus]; if (terminationStatus == 0) diff --git a/PBWebDiffController.m b/PBWebDiffController.m index e2f14d2..a537bd0 100644 --- a/PBWebDiffController.m +++ b/PBWebDiffController.m @@ -23,9 +23,9 @@ [self showDiff:diffController.diff]; } -- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(NSString *)context +- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if ([context isEqualToString: @"ChangedDiff"]) + if ([(NSString *)context isEqualToString: @"ChangedDiff"]) [self showDiff:diffController.diff]; } diff --git a/PBWebHistoryController.m b/PBWebHistoryController.m index 616655c..0f553b3 100644 --- a/PBWebHistoryController.m +++ b/PBWebHistoryController.m @@ -26,9 +26,9 @@ [self changeContentTo: historyController.webCommit]; } -- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(NSString *)context +- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if ([context isEqualToString: @"ChangedCommit"]) + if ([(NSString *)context isEqualToString: @"ChangedCommit"]) [self changeContentTo: historyController.webCommit]; else [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];