diff --git a/ApplicationController.m b/ApplicationController.m index 3a86d38..48f3964 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -15,6 +15,7 @@ #import "PBGitXProtocol.h" #import "PBPrefsWindowController.h" #import "PBNSURLPathUserDefaultsTransfomer.h" +#import "PBGitDefaults.h" @implementation ApplicationController @synthesize cliProxy; @@ -36,6 +37,8 @@ NSValueTransformer *transformer = [[PBNSURLPathUserDefaultsTransfomer alloc] init]; [NSValueTransformer setValueTransformer:transformer forName:@"PBNSURLPathUserDefaultsTransfomer"]; + // Make sure the PBGitDefaults is initialized, by calling a random method + [PBGitDefaults class]; return self; } diff --git a/English.lproj/Preferences.xib b/English.lproj/Preferences.xib index 0520f0b..5058653 100644 --- a/English.lproj/Preferences.xib +++ b/English.lproj/Preferences.xib @@ -46,7 +46,7 @@ 268 - {{17, 102}, {99, 17}} + {{17, 74}, {99, 17}} YES @@ -90,7 +90,7 @@ NSFilenamesPboardType - {{121, 98}, {179, 22}} + {{121, 70}, {179, 22}} YES @@ -112,7 +112,7 @@ 268 - {{118, 48}, {192, 42}} + {{118, 20}, {192, 42}} YES @@ -128,7 +128,7 @@ 268 - {{306, 102}, {54, 14}} + {{306, 74}, {54, 14}} YES @@ -150,6 +150,33 @@ 25 + + + 268 + {{18, 103}, {203, 18}} + + YES + + -2080244224 + 0 + Show whitespace differences + + + 1211912703 + 130 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + {400, 139} @@ -190,13 +217,8 @@ 1211912703 130 - - NSImage - NSSwitch - - - NSSwitch - + + 200 @@ -387,7 +409,7 @@ 1211912703 130 - + @@ -404,6 +426,10 @@ SUUpdater + + YES + PBShowWhitespaceDifferences + YES @@ -425,7 +451,7 @@ 1211912703 130 - + @@ -447,7 +473,7 @@ 1211912703 130 - + @@ -469,7 +495,7 @@ 1211912703 130 - + @@ -491,7 +517,7 @@ 1211912703 130 - + @@ -823,6 +849,22 @@ 113 + + + value: values.PBShowWhitespaceDifferences + + + + + + value: values.PBShowWhitespaceDifferences + value + values.PBShowWhitespaceDifferences + 2 + + + 117 + @@ -859,9 +901,10 @@ YES - + + General @@ -1169,6 +1212,20 @@ + + 114 + + + YES + + + + + + 115 + + + @@ -1187,6 +1244,8 @@ 108.IBPluginDependency 109.IBPluginDependency 11.IBPluginDependency + 114.IBPluginDependency + 115.IBPluginDependency 12.IBPluginDependency 13.IBPluginDependency 14.IBPluginDependency @@ -1253,6 +1312,8 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{514, 459}, {106, 71}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1320,7 +1381,7 @@ - 113 + 117 diff --git a/PBGitCommit.m b/PBGitCommit.m index 2e1c070..b883c95 100644 --- a/PBGitCommit.m +++ b/PBGitCommit.m @@ -7,7 +7,7 @@ // #import "PBGitCommit.h" - +#import "PBGitDefaults.h" @implementation PBGitCommit @@ -73,8 +73,12 @@ if (details != nil) return details; - details = [self.repository outputForArguments:[NSArray arrayWithObjects:@"show", @"--pretty=raw", @"-M", @"--no-color", [self realSha], nil]]; - + NSMutableArray *arguments = [NSMutableArray arrayWithObjects:@"show", @"--pretty=raw", @"-M", @"--no-color", [self realSha], nil]; + if (![PBGitDefaults showWhitespaceDifferences]) + [arguments insertObject:@"-w" atIndex:1]; + + details = [self.repository outputForArguments:arguments]; + return details; } diff --git a/PBGitDefaults.h b/PBGitDefaults.h index 2e2444b..6610681 100644 --- a/PBGitDefaults.h +++ b/PBGitDefaults.h @@ -16,5 +16,6 @@ + (BOOL) isGravatarEnabled; + (BOOL) confirmPublicGists; + (BOOL) isGistPublic; ++ (BOOL)showWhitespaceDifferences; @end diff --git a/PBGitDefaults.m b/PBGitDefaults.m index 676fa72..c605617 100644 --- a/PBGitDefaults.m +++ b/PBGitDefaults.m @@ -14,6 +14,7 @@ #define kEnableGravatar @"PBEnableGravatar" #define kConfirmPublicGists @"PBConfirmPublicGists" #define kPublicGist @"PBGistPublic" +#define kShowWhitespaceDifferences @"PBShowWhitespaceDifferences" @implementation PBGitDefaults @@ -30,6 +31,8 @@ forKey:kConfirmPublicGists]; [defaultValues setObject:[NSNumber numberWithBool:NO] forKey:kPublicGist]; + [defaultValues setObject:[NSNumber numberWithBool:YES] + forKey:kShowWhitespaceDifferences]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues]; } @@ -57,4 +60,10 @@ { return [[NSUserDefaults standardUserDefaults] boolForKey:kPublicGist]; } + + ++ (BOOL)showWhitespaceDifferences +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:kShowWhitespaceDifferences]; +} @end