split_symref_update(): add a files_ref_store argument
[gitweb.git] / graph.c
diff --git a/graph.c b/graph.c
index 23fff73e18771c4163a93ac6b16d7b2021419e90..1350bdde3be4346e8bc2038c57e4883d0ab12b25 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -234,12 +234,10 @@ struct git_graph *graph_init(struct rev_info *opt)
         * We'll automatically grow columns later if we need more room.
         */
        graph->column_capacity = 30;
-       graph->columns = xmalloc(sizeof(struct column) *
-                                graph->column_capacity);
-       graph->new_columns = xmalloc(sizeof(struct column) *
-                                    graph->column_capacity);
-       graph->mapping = xmalloc(sizeof(int) * 2 * graph->column_capacity);
-       graph->new_mapping = xmalloc(sizeof(int) * 2 * graph->column_capacity);
+       ALLOC_ARRAY(graph->columns, graph->column_capacity);
+       ALLOC_ARRAY(graph->new_columns, graph->column_capacity);
+       ALLOC_ARRAY(graph->mapping, 2 * graph->column_capacity);
+       ALLOC_ARRAY(graph->new_mapping, 2 * graph->column_capacity);
 
        /*
         * The diff output prefix callback, with this we can make
@@ -1155,20 +1153,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);
-                               strbuf_addchars(sb, ' ', num_spaces);
-                       }
-               } 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);