git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Adam Simpkins <adam@adamsimpkins.net>
To: Teemu Likonen <tlikonen@iki.fi>
Cc: git@vger.kernel.org
Subject: Re: log --graph: extra space with --pretty=oneline
Date: Thu, 29 May 2008 01:57:53 -0700	[thread overview]
Message-ID: <20080529085752.GA31865@adamsimpkins.net> (raw)
In-Reply-To: <20080528112405.GA12065@mithlond.arda.local>

On Wed, May 28, 2008 at 02:24:05PM +0300, Teemu Likonen wrote:
> Sometimes "log --graph --pretty=oneline" prints a sort of broken graph
> line. In the git repository try this:
> 
> $ git log --graph --pretty=oneline --abbrev-commit -4 8366b7b
> 
> [current graph output removed]
> 
> Extra spaces there. I don't mind that myself but to some users it may
> look like a bug. Maybe one would expect output like this:
> 
> 
> M   8366b7b... Merge branch 'maint'
> |\  
> | M   a2f5be5... Merge branch 'jk/maint-send-email-compose' into maint
> | |\  
> | | \
> | M  \  93c7b9c... Merge branch 'hb/maint-send-email-quote-recipients' into maint
> | |\  \ 
> | | \  \
> | M  \  |  6abf189... Merge branch 'maint-1.5.4' into maint
> | |\  | |
> 
> It requires more lines though.


Hmm.  Yes, the output could definitely be improved.  This problem
occurs for merges with 2 parents (not octopus merges), and only when
the branch line to the right of the merge was moving right at the end
of the previous commit (i.e., it was displayed with '\' instead of '|'
or '/').

Note that this doesn't require extra lines to fix:

M   8366b7b... Merge branch 'maint'
|\  
| M   a2f5be5... Merge branch 'jk/maint-send-email-compose' into maint
| |\  
| M \  93c7b9c... Merge branch 'hb/maint-send-email-quote-recipients' into maint
| |\ \ 
| M \ \  6abf189... Merge branch 'maint-1.5.4' into maint
| |\ \ \

This can easily be implemented by changing the output for 2-way merges
from something like this:

| M  \
| |\  |

to this:

| M \
| |\ \

However, I find this makes the graph slightly uglier when the incoming
branch to the right of the merge wasn't '\' on the previous line.  The
following change seems to look better when the branch line was '|' or
'/' on the previous line:

| M |
| |\ \

For comparison, here's a comparison of several scenarios of how the
output looks now, and how it would look with these fixes.

Current behavior        Option 1                 Option 2

| |\                    | |\                     | |\
| M  \                  | M \                    | M |
| |\  |                 | |\ \                   | |\ \

| | |                   | | |                    | | |
| M  \                  | M \                    | M |
| |\  |                 | |\ \                   | |\ \

| |  /                  | |  /                   | |  /
| M  \                  | M \                    | M |
| |\  |                 | |\ \                   | |\ \

| | |/                  | | |/                   | | |/
| M  \                  | M \                    | M |
| |\  |                 | |\ \                   | |\ \

Note that in the case of octopus merges, the current code already
produces output like that of option 1.

However, I find that both options 1 and 2 look a little uglier than
the current behavior when the branch lines need to be collapsed again
after the merge.  The graph has more pointy angles, but it is still
readable in all cases:

Current behavior        Option 1                 Option 2

| * | |                 | * | |                  | * | |
| M  \ \                | M \ \                  | M | |
| |\  | |               | |\ \ \                 | |\ \ \
|/ / / /                |/ / / /                 |/ / / /

For sections of the graph where there are several merge commits in a
row, I think option 1 looks the best:

Current behavior        Option 1                 Option 2

* |                     * |                      * |
M  \                    M \                      M |
|\  |                   |\ \                     |\ \
M  \ \                  M \ \                    M | |
|\  | |                 |\ \ \                   |\ \ \
M  \ \ \                M \ \ \                  M | | |
|\  | | |               |\ \ \ \                 |\ \ \ \


What is everyone's preference between the 3 options?  Personally, I'm
leaning towards Option 2.

I'll send out some informal patches of both option 1 and option 2, for
comparison.

In the future, the code could even be improved to dynamically choose
between these three options based on the output printed for the
previous commit.  Currently it doesn't store enough information from
the previous commit to do this.

-- 
Adam Simpkins
adam@adamsimpkins.net

  parent reply	other threads:[~2008-05-29  8:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28 11:24 log --graph: extra space with --pretty=oneline Teemu Likonen
2008-05-28 11:34 ` Wincent Colaiuta
2008-05-29  8:57 ` Adam Simpkins [this message]
2008-05-29  9:03   ` [PATCH] graph API: improve output for merge commits (option 1) Adam Simpkins
2008-05-29  9:04   ` [PATCH] graph API: improve output for merge commits (option 2) Adam Simpkins
2008-05-29 10:25   ` log --graph: extra space with --pretty=oneline Teemu Likonen
2008-06-01 20:56   ` [PATCH 0/2] graph API: improve printing of merges Adam Simpkins
2008-06-01 20:56     ` [PATCH 1/2] graph API: improve display of merge commits Adam Simpkins
2008-06-01 20:56       ` [PATCH 2/2] graph API: avoid printing unnecessary padding before some octopus merges Adam Simpkins
2008-06-01 21:50         ` Junio C Hamano
2008-06-02  0:04           ` Adam Simpkins
2008-06-02  4:41             ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080529085752.GA31865@adamsimpkins.net \
    --to=adam@adamsimpkins.net \
    --cc=git@vger.kernel.org \
    --cc=tlikonen@iki.fi \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).