Re: [PATCH 06/11] graph: tidy up display of left-skewed merges
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Oct 10, 2019, 17:19 UTC
- Message-ID
- <5c688030-6351-93a3-89bd-e666d02d12d9@gmail.com>
- In-Reply-To
- <12c0916cb1ef033f917dc065cc1f18c0477296b8.1570724021.git.gitgitgadget@gmail.com>
On 10/10/2019 12:13 PM, James Coglan via GitGitGadget wrote:
Show 45 quoted lines
> From: James Coglan <jcoglan@gmail.com> > > Currently, when we display a merge whose first parent is already present > in a column to the left of the merge commit, we display the first parent > as a veritcal pipe `|` in the GRAPH_POST_MERGE line and then immediately > enter the GRAPH_COLLAPSING state. The first-parent line tracks to the > left and all the other parent lines follow it; this creates a "kink" in > those lines: > > | *---. > | |\ \ \ > |/ / / / > | | | * > > This change tidies the display of such commits such that if the first > parent appears to the left of the merge, we render it as a `/` and the > second parent as a `|`. This reduces the horizontal and vertical space > needed to render the merge, and makes the resulting lines easier to > read. > > | *-. > |/|\ \ > | | | * > > If the first parent is separated from the merge by several columns, a > horizontal line is drawn in a similar manner to how the GRAPH_COLLAPSING > state displays the line. > > | | | *-. > | |_|/|\ \ > |/| | | | * > > This effect is applied to both "normal" two-parent merges, and to > octopus merges. It also reduces the vertical space needed for pre-commit > lines, as the merge occupies one less column than usual. > > Before: After: > > | * | * > | |\ | |\ > | | \ | * \ > | | \ |/|\ \ > | *-. \ > | |\ \ \ >
Thank you for adding these careful diagrams both to the message and the code. These concepts are hard to track without a visual aid.
[snip]
Show 9 quoted lines
> +++ b/t/t4215-log-skewed-merges.sh > @@ -0,0 +1,42 @@ > +#!/bin/sh > + > +test_description='git log --graph of skewed merges' > + > +. ./test-lib.sh > + > +test_expect_success 'setup left-skewed merge' '
Could you skew this example to include a left-skewed octopus merge (and use fewer Git processes) with the following:
git checkout --orphan _a && test_commit A && git switch -c _b _a && test_commit B && git switch -c _c _a && test_commit C && git switch -c _d _a && test_commit D && git switch -c _e _b && git merge --no-ff _c _d E && git switch -c _f _a && git merge --no-ff _d -m F && git checkout _a && git merge --no-ff _b _c _e _f -m G and I think the resulting output will be:
*-----. G |\ \ \ \ | | | | * F | |_|_|/| |/| | | | | | | * | E | |_|/|\| |/| | | | | | |/ * D | |_|__/ |/| | | | * C | |/ |/| | * B |/ * A