Sync with maint
[gitweb.git] / graph.c
diff --git a/graph.c b/graph.c
index 288b9a6f582befee2c075682dc5d75063675c6a4..c25a09a8fdaf3e90bf7e029c78127146418ab023 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -1139,7 +1139,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, j;
+       int i;
 
        if (graph->state != GRAPH_COMMIT) {
                graph_next_line(graph, sb);
@@ -1155,21 +1155,11 @@ 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];
-               struct commit *col_commit = col->commit;
-               if (col_commit == graph->commit) {
-                       strbuf_write_column(sb, col, '|');
-
-                       if (graph->num_parents < 3)
-                               strbuf_addch(sb, ' ');
-                       else {
-                               int num_spaces = ((graph->num_parents - 2) * 2);
-                               for (j = 0; j < num_spaces; j++)
-                                       strbuf_addch(sb, ' ');
-                       }
-               } else {
-                       strbuf_write_column(sb, col, '|');
+               strbuf_write_column(sb, col, '|');
+               if (col->commit == graph->commit && graph->num_parents > 2)
+                       strbuf_addchars(sb, ' ', (graph->num_parents - 2) * 2);
+               else
                        strbuf_addch(sb, ' ');
-               }
        }
 
        graph_pad_horizontally(graph, sb, graph->num_columns);