mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
GitGrapher: Reduce number of lines we output
We used to output a line for every lane after the lane in which the current commit is in, and also make it have the wrong color. This fixes the buglet and also makes sure not to draw a line when the commit has no parents.
This commit is contained in:
+3
-5
@@ -41,7 +41,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
|
||||
std::list<PBGitLane *> *currentLanes = new std::list<PBGitLane *>;
|
||||
std::list<PBGitLane *> *previousLanes = (std::list<PBGitLane *> *)pl;
|
||||
|
||||
int maxLines = (previousLanes->size() + commit.nParents + 2) * 3;
|
||||
int maxLines = (previousLanes->size() + commit.nParents + 2) * 2;
|
||||
struct PBGitGraphLine *lines = (struct PBGitGraphLine *)malloc(sizeof(struct PBGitGraphLine) * maxLines);
|
||||
int currentLine = 0;
|
||||
|
||||
@@ -63,6 +63,8 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
|
||||
currentLane = currentLanes->back();
|
||||
newPos = currentLanes->size();
|
||||
add_line(lines, ¤tLine, 1, i, newPos,(*it)->index());
|
||||
if (commit.nParents)
|
||||
add_line(lines, ¤tLine, 0, newPos, newPos,(*it)->index());
|
||||
}
|
||||
else {
|
||||
add_line(lines, ¤tLine, 1, i, newPos,(*it)->index());
|
||||
@@ -78,10 +80,6 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
|
||||
// For existing columns, we always just continue straight down
|
||||
// ^^ I don't know what that means anymore :(
|
||||
|
||||
if (currentLane)
|
||||
add_line(lines, ¤tLine, 0, newPos, newPos,(*it)->index());
|
||||
else
|
||||
add_line(lines, ¤tLine, 0, newPos, newPos, 0);
|
||||
}
|
||||
}
|
||||
//Add your own parents
|
||||
|
||||
Reference in New Issue
Block a user