From: John Keeping <john@keeping.me.uk>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: "Dale R. Worley" <worley@alum.mit.edu>,
gitster@pobox.com, git@vger.kernel.org
Subject: [PATCH] graph: output padding for merge subsequent parents
Date: Wed, 6 Feb 2013 19:57:02 +0000 [thread overview]
Message-ID: <20130206195702.GA1342@serenity.lan> (raw)
In-Reply-To: <vpqbobxwavv.fsf@grenoble-inp.fr>
On Wed, Feb 06, 2013 at 07:33:08PM +0100, Matthieu Moy wrote:
> John Keeping <john@keeping.me.uk> writes:
>
> > I would argue that the line should start with "| | ", since it really is
> > just a continuation of the same commit.
> >
> > | |
> > | | commit a393ed598e9fb11436f85bd58f1a38c82f2cadb7 (from 33e70e70c0173d634826b998bdc304f93c0966b8)
> > | | Merge: 2c1e6a3 33e70e7
> > | | Author: Matthieu Moy <Matthieu.Moy@imag.fr>
> > | | Date: Tue Feb 5 22:05:33 2013 +0100
>
> Yes.
>
> I had a look at the code, I guess the call to graph_show_commit() in
> show_log() (in log-tree.c) should have called graph_show_padding() but
> didn't in this case. Then I got lost in graph.c :-(.
I think this is the correct answer. But now I've found that "git log
--graph -c -p" doesn't indent the diff - that seems to be a separate
issue.
-- >8 --
When showing merges in git-log, the same commit is shown once for each
parent. Combined with "--graph" this results in graph_show_commit()
being called once for each parent without graph_update() being called.
Currently graph_show_commit() does not print anything on subsequent
invocations for the same commit (this was changed by commit 656197a -
"graph.c: infinite loop in git whatchanged --graph -m" from the previous
behaviour of looping infinitely).
Change this so that if the graph code believes it has already shown the
commit it prints a single padding line.
Signed-off-by: John Keeping <john@keeping.me.uk>
---
graph.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/graph.c b/graph.c
index 391a712..2a3fc5c 100644
--- a/graph.c
+++ b/graph.c
@@ -1227,6 +1227,16 @@ void graph_show_commit(struct git_graph *graph)
if (!graph)
return;
+ /*
+ * When showing a diff of a merge against each of its parents, we
+ * are called once for each parent without graph_update having been
+ * called. In this case, simply output a single padding line.
+ */
+ if (graph_is_commit_finished(graph)) {
+ graph_show_padding(graph);
+ shown_commit_line = 1;
+ }
+
while (!shown_commit_line && !graph_is_commit_finished(graph)) {
shown_commit_line = graph_next_line(graph, &msgbuf);
fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);
--
1.8.1.2
next prev parent reply other threads:[~2013-02-06 19:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-05 17:00 Bug in "git log --graph -p -m" (version 1.7.7.6) Dale R. Worley
2013-02-05 17:40 ` Junio C Hamano
2013-02-05 21:09 ` Matthieu Moy
2013-02-06 15:03 ` Dale R. Worley
2013-02-06 15:14 ` John Keeping
2013-02-06 18:33 ` Matthieu Moy
2013-02-06 19:57 ` John Keeping [this message]
2013-02-08 17:52 ` [PATCH] graph: output padding for merge subsequent parents Matthieu Moy
2013-02-08 19:40 ` 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=20130206195702.GA1342@serenity.lan \
--to=john@keeping.me.uk \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=worley@alum.mit.edu \
/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 NNTP newsgroup(s).