From 641d2dbdce04054b5c568004b86e77a8e19e0118 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Mon, 22 Dec 2008 20:10:38 +0100 Subject: [PATCH] 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. --- PBGitGrapher.mm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/PBGitGrapher.mm b/PBGitGrapher.mm index 50e6818..833ef7f 100644 --- a/PBGitGrapher.mm +++ b/PBGitGrapher.mm @@ -41,7 +41,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in std::list *currentLanes = new std::list; std::list *previousLanes = (std::list *)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