config: use git_config_parse_key() in git_config_parse_parameter()
[gitweb.git] / graph.c
diff --git a/graph.c b/graph.c
index dd1720148dc51740c96da0f4b17b59b97994abac..4200f747e7bdd65e02856c5a02c88c690fd9dd96 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -1145,6 +1145,7 @@ int graph_next_line(struct git_graph *graph, struct strbuf *sb)
 static void graph_padding_line(struct git_graph *graph, struct strbuf *sb)
 {
        int i;
+       int chars_written = 0;
 
        if (graph->state != GRAPH_COMMIT) {
                graph_next_line(graph, sb);
@@ -1160,14 +1161,21 @@ static void graph_padding_line(struct git_graph *graph, struct strbuf *sb)
         */
        for (i = 0; i < graph->num_columns; i++) {
                struct column *col = &graph->columns[i];
+
                strbuf_write_column(sb, col, '|');
-               if (col->commit == graph->commit && graph->num_parents > 2)
-                       strbuf_addchars(sb, ' ', (graph->num_parents - 2) * 2);
-               else
+               chars_written++;
+
+               if (col->commit == graph->commit && graph->num_parents > 2) {
+                       int len = (graph->num_parents - 2) * 2;
+                       strbuf_addchars(sb, ' ', len);
+                       chars_written += len;
+               } else {
                        strbuf_addch(sb, ' ');
+                       chars_written++;
+               }
        }
 
-       graph_pad_horizontally(graph, sb, graph->num_columns);
+       graph_pad_horizontally(graph, sb, chars_written);
 
        /*
         * Update graph->prev_state since we have output a padding line