Merge branch 'cd/shift-root-in-graph-fix' into jch
The graph drawing logic has been updated to avoid indenting visual roots when there are columns to their right, which prevents rendering artifacts. * cd/shift-root-in-graph-fix: graph: do not indent visual roots with columns to their right
This commit is contained in:
commit
37e7af3b0c
2 files changed
+30
No files matched your search
@@ -969,10 +969,22 @@ static int graph_is_visual_root(struct git_graph *graph,
|
||||
* already a column, so it will not be rendered below, the
|
||||
* current commit has to act as the last commit and omit
|
||||
* indentation.
|
||||
*
|
||||
* If there are columns to the right of the commit, they collapse
|
||||
* into its column once it is rendered, so nothing can be rendered
|
||||
* right below it and there is no need to indent it.
|
||||
*
|
||||
* * | <- visual root with a column to its right
|
||||
* /
|
||||
* | *
|
||||
*
|
||||
* Indenting it would also push these columns to the right, but
|
||||
* the collapsing code does not know about that offset.
|
||||
*/
|
||||
return graph_is_visual_root_candidate(graph->commit, graph) &&
|
||||
!(graph->commit_in_columns &&
|
||||
graph->columns[graph->commit_index].is_merge_parent) &&
|
||||
graph->commit_index + 1 >= graph->num_columns &&
|
||||
flags->is_next_visible &&
|
||||
(!flags->next_has_column || graph->visual_root_depth > 0);
|
||||
}
|
||||
|
||||
@@ -449,6 +449,24 @@ test_expect_success 'two unrelated merges' '
|
||||
EOF
|
||||
'
|
||||
|
||||
test_expect_success 'visual root with columns to its right is not indented' '
|
||||
create_orphan _70 && test_commit 70_A &&
|
||||
git checkout -b _71 && test_commit 71_A &&
|
||||
create_orphan _72 && test_commit 72_A &&
|
||||
TREE=$(git write-tree) &&
|
||||
MERGE=$(git commit-tree $TREE -p _72 -p _70 -m 72_merge) &&
|
||||
git reset --hard $MERGE &&
|
||||
lib_test_check_graph _72 _71 <<-\EOF
|
||||
* 72_merge
|
||||
|\
|
||||
* | 72_A
|
||||
/
|
||||
| * 71_A
|
||||
|/
|
||||
* 70_A
|
||||
EOF
|
||||
'
|
||||
|
||||
test_expect_success '--max-count treats the last visible commit as the last commit' '
|
||||
lib_test_check_graph --max-count=2 _8 _9 _10 <<-\EOF
|
||||
* 10_A
|
||||
|
||||
Reference in new issue
Block a user