From: Derrick Stolee <derrickstolee@github.com>
To: Junio C Hamano <gitster@pobox.com>,
Javier Mora <cousteaulecommandant@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Commit graph not using minimal number of columns
Date: Wed, 26 Apr 2023 06:45:24 -0400 [thread overview]
Message-ID: <86188f31-f492-d195-d4d5-b0582906621a@github.com> (raw)
In-Reply-To: <xmqq8refy114.fsf@gitster.g>
On 4/25/2023 7:50 PM, Junio C Hamano wrote:
> Javier Mora <cousteaulecommandant@gmail.com> writes:
>
>> git log --all --decorate --oneline --graph
>> # ^ displays a complete mess that doesn't resemble two tracks
That mess is this:
* ac6812d (HEAD -> fork) Merge branch 'main' (early part) into fork
|\
* \ 92dbe19 Merge branch 'main' into fork
|\ \
* \ \ c372f7b Merge branch 'main' into fork
|\ \ \
* \ \ \ 48cae29 Merge branch 'main' into fork
|\ \ \ \
* \ \ \ \ 1bd2ff0 Merge branch 'main' into fork
|\ \ \ \ \
* \ \ \ \ \ a5ab648 Merge branch 'main' into fork
|\ \ \ \ \ \
* | | | | | | 362d201 Introduced feature Z
| | | | | | | * d46dfcc (main) Add H
| | | | | | |/
| | | | | | * ac40305 Add G
| | | | | |/
| | | | | * 867e17a Add F
| | | | |/
| | | | * 23b1d2b Add E
| | | |/
| | | * 8c36fda Add D
| | |/
| | * cae1373 Add C
| |/
| * 808c738 Add B
|/
* 20b84d5 First commit
This width is necessary to avoid crossing lines _given the order
of the commits_, which is picked independently of the graph
rendering.
> "git log --all --oneline --graph --date-order"?
Here is that output, breaking topological ties with the commit
date order:
* ac6812d (HEAD -> fork) Merge branch 'main' (early part) into fork
|\
| | * d46dfcc (main) Add H
| |/
| * ac40305 Add G
* | 92dbe19 Merge branch 'main' into fork
|\|
* | c372f7b Merge branch 'main' into fork
|\ \
| | * 867e17a Add F
| |/
* | 48cae29 Merge branch 'main' into fork
|\ \
| | * 23b1d2b Add E
| |/
* | 1bd2ff0 Merge branch 'main' into fork
|\ \
| | * 8c36fda Add D
| |/
* | a5ab648 Merge branch 'main' into fork
|\ \
| | * cae1373 Add C
| |/
* | 362d201 Introduced feature Z
| * 808c738 Add B
|/
* 20b84d5 First commit
But really, the key issue is that both branches are being used
as tips. This means that in --topo-order (implied by --graph),
every commit reachable from 'fork' but not 'main' must be shown
before the first commit of 'main'.
If we only use 'fork' as a starting point, then the --topo-order
is the best of all the options:
* ac6812d (HEAD -> fork) Merge branch 'main' (early part) into fork
|\
| * ac40305 Add G
* | 92dbe19 Merge branch 'main' into fork
|\|
| * 867e17a Add F
* | c372f7b Merge branch 'main' into fork
|\|
| * 23b1d2b Add E
* | 48cae29 Merge branch 'main' into fork
|\|
| * 8c36fda Add D
* | 1bd2ff0 Merge branch 'main' into fork
|\|
| * cae1373 Add C
* | a5ab648 Merge branch 'main' into fork
|\|
| * 808c738 Add B
* | 362d201 Introduced feature Z
|/
* 20b84d5 First commit
I don't think there is anything actionable to do here, as
these commit-ordering options are well-defined and should not
be altered. If there was an algorithm to modify the commit
order in such a way that minimized the graph output, that
would be interesting, but the cases it minimizes are probably
too rare to be worth the effort.
Thanks,
-Stolee
next prev parent reply other threads:[~2023-04-26 10:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-25 23:39 Commit graph not using minimal number of columns Javier Mora
2023-04-25 23:50 ` Junio C Hamano
2023-04-26 10:45 ` Derrick Stolee [this message]
2023-04-26 16:10 ` Junio C Hamano
2023-04-26 17:35 ` Derrick Stolee
2023-04-26 17:43 ` Junio C Hamano
2023-04-27 13:02 ` Derrick Stolee
2023-04-27 18:24 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86188f31-f492-d195-d4d5-b0582906621a@github.com \
--to=derrickstolee@github.com \
--cc=cousteaulecommandant@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).