]> git.ipfire.org Git - thirdparty/git.git/blobdiff - graph.c
Merge branch 'jk/escaped-wildcard-dwim'
[thirdparty/git.git] / graph.c
diff --git a/graph.c b/graph.c
index 66ae18add834e7a74cc68692947a8a464b6530cc..4fb25ad464db5778262936cdcc97b5088abc7678 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -1063,7 +1063,7 @@ static void graph_output_post_merge_line(struct git_graph *graph, struct graph_l
        int i, j;
 
        struct commit_list *first_parent = first_interesting_parent(graph);
-       int seen_parent = 0;
+       struct column *parent_col = NULL;
 
        /*
         * Output the post-merge row
@@ -1117,12 +1117,17 @@ static void graph_output_post_merge_line(struct git_graph *graph, struct graph_l
                        graph_line_addch(line, ' ');
                } else {
                        graph_line_write_column(line, col, '|');
-                       if (graph->merge_layout != 0 || i != graph->commit_index - 1)
-                               graph_line_addch(line, seen_parent ? '_' : ' ');
+                       if (graph->merge_layout != 0 || i != graph->commit_index - 1) {
+                               if (parent_col)
+                                       graph_line_write_column(
+                                               line, parent_col, '_');
+                               else
+                                       graph_line_addch(line, ' ');
+                       }
                }
 
                if (col_commit == first_parent->item)
-                       seen_parent = 1;
+                       parent_col = col;
        }
 
        /*
@@ -1219,21 +1224,23 @@ static void graph_output_collapsing_line(struct git_graph *graph, struct graph_l
                         *
                         * The space just to the left of this
                         * branch should always be empty.
-                        *
-                        * The branch to the left of that space
-                        * should be our eventual target.
                         */
                        assert(graph->mapping[i - 1] > target);
                        assert(graph->mapping[i - 2] < 0);
-                       assert(graph->mapping[i - 3] == target);
                        graph->mapping[i - 2] = target;
                        /*
                         * Mark this branch as the horizontal edge to
                         * prevent any other edges from moving
                         * horizontally.
                         */
-                       if (horizontal_edge == -1)
-                               horizontal_edge = i;
+                       if (horizontal_edge == -1) {
+                               int j;
+                               horizontal_edge_target = target;
+                               horizontal_edge = i - 1;
+
+                               for (j = (target * 2) + 3; j < (i - 2); j += 2)
+                                       graph->mapping[j] = target;
+                       }
                }
        }