Code

graph API: fix graph mis-alignment after uninteresting commits
authorAdam Simpkins <adam@adamsimpkins.net>
Sat, 24 May 2008 02:24:10 +0000 (19:24 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 25 May 2008 18:42:44 +0000 (11:42 -0700)
The graphing code had a bug that caused it to output branch lines
incorrectly after ignoring an uninteresting commit.  When computing how
to match up the branch lines from the current commit to the next one, it
forgot to take into account that it needed to initially start with 2
empty spaces where the missing commit would have gone.

So, instead of drawing this,

  | * | <- Commit with uninteresting parent
  |  /
  * |

It used to incorrectly draw this:

  | * | <- Commit with uninteresting parent
  * |

Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
graph.c

diff --git a/graph.c b/graph.c
index 9d6ed30b0bef22bd8b56da9a12688c760b661776..400f0147bfc38cff0127891874d0477673440f8f 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -190,7 +190,10 @@ static void graph_insert_into_new_columns(struct git_graph *graph,
         * Ignore uinteresting and pruned commits
         */
        if (commit->object.flags & (UNINTERESTING | TREESAME))
+       {
+               *mapping_index += 2;
                return;
+       }
 
        /*
         * If the commit is already in the new_columns list, we don't need to