Skip to content

Commit dedd02d

Browse files
committed
Merge branch 'master' of git://github.com/pieter/gitx
2 parents a537cd5 + 1854fc0 commit dedd02d

29 files changed

+1167
-4117
lines changed

GitX.xcodeproj/project.pbxproj

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
F59116E90E843BCB0072CCB1 /* PBGitCommitController.m in Sources */ = {isa = PBXBuildFile; fileRef = F59116E80E843BCB0072CCB1 /* PBGitCommitController.m */; };
9898
F593DF780E9E636C003A8559 /* PBFileChangesTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = F593DF770E9E636C003A8559 /* PBFileChangesTableView.m */; };
9999
F5945E170E02B0C200706420 /* PBGitRepository.m in Sources */ = {isa = PBXBuildFile; fileRef = F5945E160E02B0C200706420 /* PBGitRepository.m */; };
100+
F59F1DD5105C4FF300115F88 /* PBGitIndex.m in Sources */ = {isa = PBXBuildFile; fileRef = F59F1DD4105C4FF300115F88 /* PBGitIndex.m */; };
100101
F5AD56790E79B78100EDAAFE /* PBCommitList.m in Sources */ = {isa = PBXBuildFile; fileRef = F5AD56780E79B78100EDAAFE /* PBCommitList.m */; };
101102
F5B721C40E05CF7E00AF29DC /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = F5B721C20E05CF7E00AF29DC /* MainMenu.xib */; };
102103
F5C007750E731B48007B84B2 /* PBGitRef.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C007740E731B48007B84B2 /* PBGitRef.m */; };
@@ -250,6 +251,8 @@
250251
F593DF770E9E636C003A8559 /* PBFileChangesTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBFileChangesTableView.m; sourceTree = "<group>"; };
251252
F5945E150E02B0C200706420 /* PBGitRepository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRepository.h; sourceTree = "<group>"; };
252253
F5945E160E02B0C200706420 /* PBGitRepository.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRepository.m; sourceTree = "<group>"; };
254+
F59F1DD3105C4FF300115F88 /* PBGitIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitIndex.h; sourceTree = "<group>"; };
255+
F59F1DD4105C4FF300115F88 /* PBGitIndex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitIndex.m; sourceTree = "<group>"; };
253256
F5AD56770E79B78100EDAAFE /* PBCommitList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCommitList.h; sourceTree = "<group>"; };
254257
F5AD56780E79B78100EDAAFE /* PBCommitList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCommitList.m; sourceTree = "<group>"; };
255258
F5B721C30E05CF7E00AF29DC /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
@@ -467,6 +470,7 @@
467470
F56174540E05887E001DCD79 /* Git */ = {
468471
isa = PBXGroup;
469472
children = (
473+
F59F1DD2105C4FDE00115F88 /* Index */,
470474
F5E927E30E883D6800056E75 /* Commit */,
471475
F5E927E10E883D2E00056E75 /* History */,
472476
F5945E150E02B0C200706420 /* PBGitRepository.h */,
@@ -549,6 +553,17 @@
549553
name = SpeedTest;
550554
sourceTree = "<group>";
551555
};
556+
F59F1DD2105C4FDE00115F88 /* Index */ = {
557+
isa = PBXGroup;
558+
children = (
559+
F5E927F60E883E7200056E75 /* PBChangedFile.h */,
560+
F5E927F70E883E7200056E75 /* PBChangedFile.m */,
561+
F59F1DD3105C4FF300115F88 /* PBGitIndex.h */,
562+
F59F1DD4105C4FF300115F88 /* PBGitIndex.m */,
563+
);
564+
name = Index;
565+
sourceTree = "<group>";
566+
};
552567
F5B161BB0EAB6E0C005A1DE1 /* Diff */ = {
553568
isa = PBXGroup;
554569
children = (
@@ -604,8 +619,6 @@
604619
children = (
605620
93F7857D0EA3ABF100C1F443 /* PBCommitMessageView.h */,
606621
93F7857E0EA3ABF100C1F443 /* PBCommitMessageView.m */,
607-
F5E927F60E883E7200056E75 /* PBChangedFile.h */,
608-
F5E927F70E883E7200056E75 /* PBChangedFile.m */,
609622
F593DF760E9E636C003A8559 /* PBFileChangesTableView.h */,
610623
F593DF770E9E636C003A8559 /* PBFileChangesTableView.m */,
611624
);
@@ -854,6 +867,7 @@
854867
47DBDBCA0E95016F00671A1E /* PBNSURLPathUserDefaultsTransfomer.m in Sources */,
855868
F562C8870FE1766C000EC528 /* NSString_RegEx.m in Sources */,
856869
EB2A734A0FEE3F09006601CF /* PBCollapsibleSplitView.m in Sources */,
870+
F59F1DD5105C4FF300115F88 /* PBGitIndex.m in Sources */,
857871
);
858872
runOnlyForDeploymentPostprocessing = 0;
859873
};

NSString_RegEx.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ - (NSArray *) substringsMatchingRegularExpression:(NSString *)pattern count:(int
5757
break;
5858

5959
NSRange range = NSMakeRange(pmatch[i].rm_so, pmatch[i].rm_eo - pmatch[i].rm_so);
60-
NSString * substring = [self substringWithRange:range];
60+
NSString * substring = [[[NSString alloc] initWithBytes:[self UTF8String] + range.location
61+
length:range.length
62+
encoding:NSUTF8StringEncoding] autorelease];
6163
[outMatches addObject:substring];
6264

6365
if (ranges)

PBCLIProxy.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ - (BOOL)openRepository:(NSURL*)repositoryPath arguments: (NSArray*) args error:(
5656
[document.windowController showCommitView:self];
5757
else {
5858
PBGitRevSpecifier* rev = [[PBGitRevSpecifier alloc] initWithParameters:arguments];
59+
rev.workingDirectory = repositoryPath;
5960
document.currentBranch = [document addBranch: rev];
6061
[document.windowController showHistoryView:self];
6162
}

PBGitBinary.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#import <Cocoa/Cocoa.h>
1010

11+
#define MIN_GIT_VERSION "1.6.0"
1112

1213
@interface PBGitBinary : NSObject {
1314

PBGitBinary.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ + (BOOL) acceptBinary:(NSString *)path
3737
if (!version)
3838
return NO;
3939

40-
int c = [version compare:@"1.5.4"];
40+
int c = [version compare:@"" MIN_GIT_VERSION];
4141
if (c == NSOrderedSame || c == NSOrderedDescending) {
4242
gitPath = path;
4343
return YES;
@@ -60,7 +60,7 @@ + (void) initialize
6060
alternateButton:nil
6161
otherButton:nil
6262
informativeTextWithFormat:@"You entered a custom git path in the Preferences pane, "
63-
"but this path is not a valid git v1.5.4 or higher binary. We're going to use the default "
63+
"but this path is not a valid git v" MIN_GIT_VERSION " or higher binary. We're going to use the default "
6464
"search paths instead"] runModal];
6565
}
6666

@@ -80,7 +80,7 @@ + (void) initialize
8080
return;
8181
}
8282

83-
NSLog(@"Could not find a git binary higher than version 1.5.4.");
83+
NSLog(@"Could not find a git binary higher than version " MIN_GIT_VERSION);
8484
}
8585

8686
+ (NSString *) path;
@@ -109,7 +109,7 @@ + (NSArray *) searchLocations
109109
+ (NSString *) notFoundError
110110
{
111111
NSMutableString *error = [NSMutableString stringWithString:
112-
@"Could not find a git binary version 1.5.4 or higher.\n"
112+
@"Could not find a git binary version " MIN_GIT_VERSION " or higher.\n"
113113
"Please make sure there is a git binary in one of the following locations:\n\n"];
114114
for (NSString *location in [PBGitBinary searchLocations]) {
115115
[error appendFormat:@"\t%@\n", location];

PBGitCommit.m

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,10 @@ - (NSString *)realSha
6666
return str;
6767
}
6868

69-
// NOTE: This method should remain threadsafe, as we load it in async
70-
// from the web view.
69+
// FIXME: Remove this method once it's unused.
7170
- (NSString*) details
7271
{
73-
if (details != nil)
74-
return details;
75-
76-
NSMutableArray *arguments = [NSMutableArray arrayWithObjects:@"show", @"--pretty=raw", @"-M", @"--no-color", [self realSha], nil];
77-
if (![PBGitDefaults showWhitespaceDifferences])
78-
[arguments insertObject:@"-w" atIndex:1];
79-
80-
details = [self.repository outputForArguments:arguments];
81-
82-
return details;
72+
return @"";
8373
}
8474

8575
- (NSString *) patch

PBGitCommitController.h

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
#import <Cocoa/Cocoa.h>
1010
#import "PBViewController.h"
1111

12-
@class PBGitIndexController;
13-
@class PBIconAndTextCell;
14-
@class PBWebChangesController;
12+
@class PBGitIndexController, PBIconAndTextCell, PBWebChangesController, PBGitIndex;
1513

1614
@interface PBGitCommitController : PBViewController {
17-
NSMutableArray *files;
15+
// This might have to transfer over to the PBGitRepository
16+
// object sometime
17+
PBGitIndex *index;
1818

1919
IBOutlet NSTextView *commitMessageView;
2020
IBOutlet NSArrayController *unstagedFilesController;
@@ -24,28 +24,12 @@
2424
IBOutlet PBWebChangesController *webController;
2525

2626
NSString *status;
27-
28-
// We use busy as a count of active processes.
29-
// You can increase it when your process start
30-
// And decrease it after you have finished.
31-
int busy;
32-
BOOL amend;
33-
NSDictionary *amendEnvironment;
34-
27+
BOOL busy;
3528
}
3629

37-
@property (retain) NSMutableArray *files;
38-
@property (copy) NSString *status;
39-
@property (assign) int busy;
40-
@property (assign) BOOL amend;
41-
42-
- (void) readCachedFiles:(NSNotification *)notification;
43-
- (void) readOtherFiles:(NSNotification *)notification;
44-
- (void) readUnstagedFiles:(NSNotification *)notification;
45-
- (void) stageHunk: (NSString *)hunk reverse:(BOOL)reverse;
46-
- (void)discardHunk:(NSString *)hunk;
47-
48-
- (NSString *)parentTree;
30+
@property(copy) NSString *status;
31+
@property(readonly) PBGitIndex *index;
32+
@property(assign) BOOL busy;
4933

5034
- (IBAction) refresh:(id) sender;
5135
- (IBAction) commit:(id) sender;

0 commit comments

Comments
 (0)