git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Micha Nelissen <nelissen.micha@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/1] Add feature to show log as a tree
Date: Mon, 4 Mar 2019 10:13:23 +0100	[thread overview]
Message-ID: <cc77a06e-2fa7-f3b3-dcc4-9bf385d7f384@gmail.com> (raw)
In-Reply-To: <xmqqd0n814kg.fsf@gitster-ct.c.googlers.com>

On 03-03-2019 14:16, Junio C Hamano wrote:
> I am not sure what you mean by a "tree".  It definitely is not a
> tree perceived by Git users (which is what represents a directory
> structure), and abusing the established term is confusing.

I called it tree because the output looks like (right half) of a tree. 
I'm open to alternatives though.

> There is no inherent ordering among children of a given commit, so
> you'd invent some way to define what "the first child" is.  That
> much can be read from the above, but what is missing is why do you
> even need to bother.  What benefit do users get by identifying "the
> first" child and cutting all others off---that is the necessary
> justification for this change, which is missing from the above
> explanation.

Right, in my mind the problem statement is so clear and I didn't write 
it down. There should have been an introduction paragraph.

Problem I want to solve. The --graph output is useful but often 
unreadable, due to the many parallel lines. On the other hand, with the 
default straight line log output all structure is lost. I am trying some 
middle ground to see merge structure, but keep history readable. I 
noticed in particular the branch point causes a line to go around or go 
in between many commits leading to clutter, so I want to remove these. 
By itself the exact point branched from is rarely important (at least to 
me). And if it is, then there still is --graph :-).

> "A (depth) level" is poorly explained---in fact, it is not explained
> what it means at all.  "We designate the first child of each commit
> by some magic" is all we can read from it.

When processing the commit nodes. Start with depth level 0. Given some 
current depth level D, assign depth level D, D+1, ... D+N-1 to the N 
parents of a (merge) commit. Recurse.

In the output, the depth level is more or less the column number the 
star '*' is in. (Although after merges of merges, there will be gaps in 
the level numbering.)

> After explaining "some magic" in a more meaningful way, perhaps
> you'd realize that you'd want to stop saying "first child".  It

OK well, the term "first parent" is already in the man page, right? 
--first-parent. So the first child of a commit is the commit C among all 
children H, such that when all of H are traced back to a common point S, 
the trace line from C is the one that ends being the first parent of S.

> ignore all side branches and concentrate only on the trunk of a
> tree).  And I'd probably call each child that is on the "trunk" line
> of the most important lineage "primary child" or something like
> that.

Sort of, but remember this works recursive, there can be merges of 
merges. Therefore the output is not a single trunk line. In other words, 
the above commit S doesn't need to be on the trunk (or, '*' completely 
left in the graph output).

> In any case, if this is to sit next to and be friends with
> "--topo-order", the option should be named as "--some-order".
> The option name "--tree" (or "--blob", "--tag", or "--commit" for
> that matter) is obviously unacceptable if the option is about
> specifying how the commits in the "git log" output are ordered.

I see it as alternative to the --graph option. I also made it jump 
there, but maybe gotos are rejected from style point of view. In this 
case I thought it would be clear to see it as alternative to --graph.

It doesn't do justice in my opinion to call it --graph --micha-order (or 
whatever ;-)), as it is not only about changing the order of commit 
display. But again, I'm open to alternatives, I can make a personal 
alias anyway :-).

> Having said that, if you are omitting commits that are not on the
> primary lineage of the history, then this is not "--anything-order"
> option, in which case it may want to sit next to and be friends with

Ah no, it doesn't omit any commits. All commits are displayed.

> Without clear explanation of what the change attempts to achieve in
> docs and tests, there is no way to review to see if the new code is
> correct.

How can I add tests for this feature? I'm also open to what kinds of 
documentation to add, as I find it way easier to explain when you 
actually run it to see the output it generates, than from abstract 
paragraph of documentation text (like a manpage has). Some 
mathematical-type of explanation like above is also not really 
immediately enlightening, and also not necessary to use it I think.

Thanks for review, Micha



      reply	other threads:[~2019-03-04  9:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-03 10:37 [PATCH 1/1] Add feature to show log as a tree Micha Nelissen
2019-03-03 13:16 ` Junio C Hamano
2019-03-04  9:13   ` Micha Nelissen [this message]

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=cc77a06e-2fa7-f3b3-dcc4-9bf385d7f384@gmail.com \
    --to=nelissen.micha@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.
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).