All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: git@vger.kernel.org, Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH v3 1/2] diff: add --line-prefix option for passing in a prefix
Date: Wed, 10 Aug 2016 14:58:50 -0700	[thread overview]
Message-ID: <xmqq4m6s476t.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160810211710.23173-1-jacob.e.keller@intel.com> (Jacob Keller's message of "Wed, 10 Aug 2016 14:17:09 -0700")

Jacob Keller <jacob.e.keller@intel.com> writes:

> As suggested by Junio, I implemented --line-prefix to enable the graph
> display correctly. This works by a neat trick of adding to the msgbuf,
> so no code needs to be altered. I presumed that the line prefix should
> go *after* the graphs own prefix.

I do not understand the last sentence.

The motivation I suggested the --line-prefix for is for a scenario
in which "git log -p --graph" that recurses into a submodule causes
"git diff A B" between the two commits in a submodule to run; the
internal diff machinery driven by "log -p --graph" for the
superproject knows what the graph lines that depict the lineages of
history in the superproject should look like, but the "git diff A B"
in the submodule of course does not, so while showing e.g. "| | |"
(three lineages) for the history in the superproject, you would run
"git diff --line-prefix='| | | ' A B" and by showing them before
anything that "git diff A B" without the new option would have
produced, you could mimick and match the graph output in the
superproject.

In that scenario, the line prefix _is_ the graph's prefix in the
superproject.

You might be envisioning a future enhancement where the recursive
one uses not "-Submodule commit A"/"-Submodule commit B", and not
"diff A B", but "log -p A...B" in the submodule, and in such a case,
it might make sense to run "log -p --graph A...B" instead when the
command the end user run in the superproject asked for "--graph".
You would use the same "--line-prefix='| | | '" when running the
"log -p --graph A...B" command in the submodule, so that the output
for the submodule will go _after_ the graph of the superproject, but
in that case, the output for the submodule would also include its
own graph to show the relationship between A and B.  The line-prefix
must come before that graph part (and also if it is "git log" run in
the submodule, the same line-prefix must come before each line of
the log message output).

With that understanding/assumption, "line prefix should go after the
graph's own prefix" sounds like a wrong choice to me.  Shouldn't the
prefix go before everything else?


  parent reply	other threads:[~2016-08-10 21:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 21:17 [PATCH v3 1/2] diff: add --line-prefix option for passing in a prefix Jacob Keller
2016-08-10 21:17 ` [PATCH v3 2/2] diff: add SUBMODULE_DIFF format to display submodule diff Jacob Keller
2016-08-10 22:05   ` Junio C Hamano
2016-08-10 22:45     ` Jacob Keller
2016-08-10 21:58 ` Junio C Hamano [this message]
2016-08-10 22:42   ` [PATCH v3 1/2] diff: add --line-prefix option for passing in a prefix Jacob Keller
2016-08-10 22:53   ` Jacob Keller

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=xmqq4m6s476t.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jacob.keller@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.