diff --git a/PBGitCommit.m b/PBGitCommit.m index ac2bd1f..067d6f4 100644 --- a/PBGitCommit.m +++ b/PBGitCommit.m @@ -74,6 +74,9 @@ NSString * const kGitXCommitType = @"commit"; - (BOOL)isEqual:(id)otherCommit { + if (self == otherCommit) + return YES; + if (![otherCommit isMemberOfClass:[PBGitCommit class]]) return NO; diff --git a/PBGitGrapher.mm b/PBGitGrapher.mm index abd6327..41401d6 100644 --- a/PBGitGrapher.mm +++ b/PBGitGrapher.mm @@ -48,6 +48,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in PBGitLane *currentLane = NULL; BOOL didFirst = NO; + git_oid commit_oid = [[commit sha] oid]; // First, iterate over earlier columns and pass through any that don't want this commit if (previous != nil) { @@ -57,7 +58,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in i++; // This is our commit! We should do a "merge": move the line from // our upperMapping to their lowerMapping - if ((*it)->isCommit([[commit sha] oid])) { + if ((*it)->isCommit(commit_oid)) { if (!didFirst) { didFirst = YES; currentLanes->push_back(*it); @@ -127,7 +128,14 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in add_line(lines, ¤tLine, 0, currentLanes->size(), newPos, newLane->index()); } - previous = [[PBGraphCellInfo alloc] initWithPosition:newPos andLines:lines]; + if (commit.lineInfo) { + previous = commit.lineInfo; + previous.position = newPos; + previous.lines = lines; + } + else + previous = [[PBGraphCellInfo alloc] initWithPosition:newPos andLines:lines]; + if (currentLine > maxLines) NSLog(@"Number of lines: %i vs allocated: %i", currentLine, maxLines); diff --git a/PBGraphCellInfo.h b/PBGraphCellInfo.h index 5948e0f..e959061 100644 --- a/PBGraphCellInfo.h +++ b/PBGraphCellInfo.h @@ -18,7 +18,7 @@ char sign; } -@property(readonly) struct PBGitGraphLine *lines; +@property(assign) struct PBGitGraphLine *lines; @property(assign) int nLines; @property(assign) int position, numColumns; @property(assign) char sign;