]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ps/shift-root-in-graph' into seen
authorJunio C Hamano <gitster@pobox.com>
Tue, 28 Apr 2026 01:22:01 +0000 (10:22 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Apr 2026 01:22:01 +0000 (10:22 +0900)
In a history with more than one root commit, "git log --graph
--oneline" stuffed an unrelated commit immediately below a root
commit, which has been corrected by making the spot below a root
unavailable.

* ps/shift-root-in-graph:
  graph: add indentation for commits preceded by a parentless commit

1  2 
graph.c
t/t4215-log-skewed-merges.sh

diff --cc graph.c
index 842282685f6cef791fdb1039ffe91e0fd2e3ed9e,97292df998f5e45df1299cbfbcae9bcd07683973..357dde0240ca47581e8cd24bbf9892a1001add4e
+++ b/graph.c
@@@ -868,11 -908,10 +930,14 @@@ static void graph_output_padding_line(s
         * Output a padding row, that leaves all branch lines unchanged
         */
        for (i = 0; i < graph->num_new_columns; i++) {
-               graph_line_write_column(line, &graph->new_columns[i], '|');
 +              if (graph_needs_truncation(graph, i)) {
 +                      graph_line_addstr(line, "~ ");
 +                      break;
 +              }
+               if (graph->new_columns[i].is_placeholder)
+                       graph_line_write_column(line, &graph->new_columns[i], ' ');
+               else
+                       graph_line_write_column(line, &graph->new_columns[i], '|');
                graph_line_addch(line, ' ');
        }
  }
@@@ -1243,14 -1225,20 +1335,25 @@@ static void graph_output_post_merge_lin
                                graph_line_write_column(line, col, '\\');
                        else
                                graph_line_write_column(line, col, '|');
 -                      graph_line_addch(line, ' ');
 +                      /*
 +                       * If it's between two lanes and next would be truncated,
 +                       * don't add space padding.
 +                       */
 +                      if (!graph_needs_truncation(graph, i + 1))
 +                              graph_line_addch(line, ' ');
                } else {
-                       graph_line_write_column(line, col, '|');
+                       if (col->is_placeholder) {
+                               /*
+                                * Same placeholder handling as in
+                                * graph_output_commit_line().
+                                */
+                               if (seen_this)
+                                       continue;
+                               graph_line_write_column(line, col, ' ');
+                       } else {
+                               graph_line_write_column(line, col, '|');
+                       }
                        if (graph->merge_layout != 0 || i != graph->commit_index - 1) {
                                if (parent_col)
                                        graph_line_write_column(
Simple merge