From: "Michał Kiedrowicz" <michal.kiedrowicz@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: Re: [BUG] Endless loop in git whatchanged --graph -m
Date: Wed, 29 Jul 2009 18:32:59 +0200 [thread overview]
Message-ID: <20090729183259.2552912f@gmail.com> (raw)
In-Reply-To: <20090725014500.66680dc3@gmail.com>
Michał Kiedrowicz <michal.kiedrowicz@gmail.com> wrote:
> Steps to reproduce:
>
> (Simple merge of two branches)
>
> $ mkdir a && cd a && git init
>
> $ echo file1 > file1
> $ git add file1 && git commit -m initial
>
> $ echo file1 >> file1
> $ git commit -a -m "commit on master"
>
> $ git checkout -b experimental HEAD^
> $ echo file2 > file2
> $ git add file2 && git commit -m "commit on experimental"
>
> $ git checkout master && git merge experimental
>
> $ git whatchanged --graph -m
> <endless loop here>
>
> Here is a simple patch, which solves this problem by removing constraint from
> git_show_commit(). I'm not sure if this is the best solution. Maybe some upper
> layer shouldn't call git_show_commit()?
>
> Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
> ---
>
> diff --git a/Documentation/technical/api-history-graph.txt b/Documentation/technical/api-history-graph.txt
> index d66e61b..32d961a 100644
> --- a/Documentation/technical/api-history-graph.txt
> +++ b/Documentation/technical/api-history-graph.txt
> @@ -36,11 +36,11 @@ The following utility functions are wrappers around `graph_next_line()` and
> They can all be called with a NULL graph argument, in which case no graph
> output will be printed.
>
> -* `graph_show_commit()` calls `graph_next_line()` until it returns non-zero.
> - This prints all graph lines up to, and including, the line containing this
> - commit. Output is printed to stdout. The last line printed does not contain
> - a terminating newline. This should not be called if the commit line has
> - already been printed, or it will loop forever.
> +* `graph_show_commit()` calls `graph_next_line()` and
> + `graph_is_commit_finished()` until one of them return non-zero. This prints
> + all graph lines up to, and including, the line containing this commit.
> + Output is printed to stdout. The last line printed does not contain a
> + terminating newline.
>
> * `graph_show_oneline()` calls `graph_next_line()` and prints the result to
> stdout. The line printed does not contain a terminating newline.
> diff --git a/graph.c b/graph.c
> index e466770..049cdbc 100644
> --- a/graph.c
> +++ b/graph.c
> @@ -1198,7 +1198,7 @@ void graph_show_commit(struct git_graph *graph)
> if (!graph)
> return;
>
> - while (!shown_commit_line) {
> + 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);
> if (!shown_commit_line)
Hi, has anyone looked at this?
Michał Kiedrowicz
prev parent reply other threads:[~2009-07-29 16:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-24 23:45 [BUG] Endless loop in git whatchanged --graph -m Michał Kiedrowicz
2009-07-29 16:32 ` Michał Kiedrowicz [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090729183259.2552912f@gmail.com \
--to=michal.kiedrowicz@gmail.com \
--cc=git@vger.kernel.org \
/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).