mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
PBGitRepository: Also request parents when doing our revwalk
This is necessary for cool graph displaying, to be made.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
NSString* subject;
|
||||
NSString* author;
|
||||
NSString* details;
|
||||
NSArray* parents;
|
||||
NSDate* date;
|
||||
PBGitRepository* repository;
|
||||
}
|
||||
@@ -24,6 +25,7 @@
|
||||
@property (copy) NSString* sha;
|
||||
@property (copy) NSString* subject;
|
||||
@property (copy) NSString* author;
|
||||
@property (retain) NSArray* parents;
|
||||
@property (copy) NSDate* date;
|
||||
@property (readonly) NSString* dateString;
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
|
||||
@implementation PBGitCommit
|
||||
|
||||
@synthesize sha, repository, subject, author, date;
|
||||
@synthesize sha, repository, subject, author, date, parents;
|
||||
|
||||
|
||||
- (NSString *) dateString
|
||||
|
||||
+4
-2
@@ -76,7 +76,7 @@ static NSString* gitPath = @"/usr/bin/env";
|
||||
|
||||
NSMutableArray * newArray = [NSMutableArray array];
|
||||
NSDate* start = [NSDate date];
|
||||
NSFileHandle* handle = [self handleForCommand:@"log --pretty=format:%H\01%an\01%s\01%at HEAD"];
|
||||
NSFileHandle* handle = [self handleForCommand:@"log --pretty=format:%H\01%an\01%s\01%P\01%at HEAD"];
|
||||
|
||||
int fd = [handle fileDescriptor];
|
||||
FILE* f = fdopen(fd, "r");
|
||||
@@ -102,11 +102,13 @@ static NSString* gitPath = @"/usr/bin/env";
|
||||
|
||||
// If we are here, we currentLine is a full line.
|
||||
NSArray* components = [currentLine componentsSeparatedByString:@"\01"];
|
||||
if ([components count] < 4) {
|
||||
if ([components count] < 5) {
|
||||
NSLog(@"Can't split string: %@", currentLine);
|
||||
continue;
|
||||
}
|
||||
PBGitCommit* newCommit = [[PBGitCommit alloc] initWithRepository: self andSha: [components objectAtIndex:0]];
|
||||
NSArray* parents = [[components objectAtIndex:3] componentsSeparatedByString:@" "];
|
||||
newCommit.parents = parents;
|
||||
newCommit.subject = [components objectAtIndex:2];
|
||||
newCommit.author = [components objectAtIndex:1];
|
||||
newCommit.date = [NSDate dateWithTimeIntervalSince1970:[[components objectAtIndex:3] intValue]];
|
||||
|
||||
+1
-4
@@ -27,10 +27,7 @@ var Commit = Class.create({
|
||||
this.committer_email = match[2];
|
||||
this.committer_date = new Date(parseInt(match[3]) * 1000);
|
||||
|
||||
this.parents = $A(this.header.match(/\nparent ([0-9a-f]{40,40})/g)).map(function(x) {
|
||||
return x.replace("\nparent ","");
|
||||
});
|
||||
|
||||
this.parents = obj.parents;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user