]> git.ipfire.org Git - thirdparty/git.git/commit - t/t4214-log-graph-octopus.sh
graph: smooth appearance of collapsing edges on commit lines
authorJames Coglan <jcoglan@gmail.com>
Tue, 15 Oct 2019 23:47:57 +0000 (23:47 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 16 Oct 2019 02:11:25 +0000 (11:11 +0900)
commit479db18bc0c38ed610fba56f3cc98abd7977e695
tree2afb51bffdcba98597eeea727e9458993daca110
parent0195285b956e1b52defa6c259253a7b888fc25df
graph: smooth appearance of collapsing edges on commit lines

When a graph contains edges that are in the process of collapsing to the
left, but those edges cross a commit line, the effect is that the edges
have a jagged appearance:

        *
        |\
        | *
        |  \
        *-. \
        |\ \ \
        | | * |
        | * | |
        | |/ /
        * | |
        |/ /
        * |
        |/
        *

We already takes steps to smooth edges like this when they're expanding;
when an edge appears to the right of a merge commit marker on a
GRAPH_COMMIT line immediately following a GRAPH_POST_MERGE line, we
render it as a `\`:

        * \
        |\ \
        | * \
        | |\ \

We can make a similar improvement to collapsing edges, making them
easier to follow and giving the overall graph a feeling of increased
symmetry:

        *
        |\
        | *
        |  \
        *-. \
        |\ \ \
        | | * |
        | * | |
        | |/ /
        * / /
        |/ /
        * /
        |/
        *

To do this, we introduce a new special case for edges on GRAPH_COMMIT
lines that immediately follow a GRAPH_COLLAPSING line. By retaining a
copy of the `mapping` array used to render the GRAPH_COLLAPSING line in
the `old_mapping` array, we can determine that an edge is collapsing
through the GRAPH_COMMIT line and should be smoothed.

Signed-off-by: James Coglan <jcoglan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
graph.c
t/t3430-rebase-merges.sh
t/t4202-log.sh
t/t4214-log-graph-octopus.sh
t/t4215-log-skewed-merges.sh
t/t6016-rev-list-graph-simplify-history.sh