Skip to content

Commit 447a8dc

Browse files
committed
PBGitRepository: Also request parents when doing our revwalk
This is necessary for cool graph displaying, to be made.
1 parent 7555b1f commit 447a8dc

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

PBGitCommit.h

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
NSString* subject;
1616
NSString* author;
1717
NSString* details;
18+
NSArray* parents;
1819
NSDate* date;
1920
PBGitRepository* repository;
2021
}
@@ -24,6 +25,7 @@
2425
@property (copy) NSString* sha;
2526
@property (copy) NSString* subject;
2627
@property (copy) NSString* author;
28+
@property (retain) NSArray* parents;
2729
@property (copy) NSDate* date;
2830
@property (readonly) NSString* dateString;
2931

PBGitCommit.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
@implementation PBGitCommit
1313

14-
@synthesize sha, repository, subject, author, date;
14+
@synthesize sha, repository, subject, author, date, parents;
1515

1616

1717
- (NSString *) dateString

PBGitRepository.m

+4-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ - (void) initializeCommits
7676

7777
NSMutableArray * newArray = [NSMutableArray array];
7878
NSDate* start = [NSDate date];
79-
NSFileHandle* handle = [self handleForCommand:@"log --pretty=format:%H\01%an\01%s\01%at HEAD"];
79+
NSFileHandle* handle = [self handleForCommand:@"log --pretty=format:%H\01%an\01%s\01%P\01%at HEAD"];
8080

8181
int fd = [handle fileDescriptor];
8282
FILE* f = fdopen(fd, "r");
@@ -102,11 +102,13 @@ - (void) initializeCommits
102102

103103
// If we are here, we currentLine is a full line.
104104
NSArray* components = [currentLine componentsSeparatedByString:@"\01"];
105-
if ([components count] < 4) {
105+
if ([components count] < 5) {
106106
NSLog(@"Can't split string: %@", currentLine);
107107
continue;
108108
}
109109
PBGitCommit* newCommit = [[PBGitCommit alloc] initWithRepository: self andSha: [components objectAtIndex:0]];
110+
NSArray* parents = [[components objectAtIndex:3] componentsSeparatedByString:@" "];
111+
newCommit.parents = parents;
110112
newCommit.subject = [components objectAtIndex:2];
111113
newCommit.author = [components objectAtIndex:1];
112114
newCommit.date = [NSDate dateWithTimeIntervalSince1970:[[components objectAtIndex:3] intValue]];

html/commit.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ var Commit = Class.create({
2727
this.committer_email = match[2];
2828
this.committer_date = new Date(parseInt(match[3]) * 1000);
2929

30-
this.parents = $A(this.header.match(/\nparent ([0-9a-f]{40,40})/g)).map(function(x) {
31-
return x.replace("\nparent ","");
32-
});
33-
30+
this.parents = obj.parents;
3431
},
3532
});
3633

0 commit comments

Comments
 (0)