git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Adam Simpkins <adam@adamsimpkins.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/3] log and rev-list: add --graph option
Date: Mon, 05 May 2008 23:41:58 -0700	[thread overview]
Message-ID: <7vtzhcgci1.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 1209897414-10091-4-git-send-email-adam@adamsimpkins.net

Adam Simpkins <adam@adamsimpkins.net> writes:

> diff --git a/builtin-rev-list.c b/builtin-rev-list.c
> index 476a870..f868290 100644
> --- a/builtin-rev-list.c
> +++ b/builtin-rev-list.c
> ...
> @@ -52,12 +53,13 @@ static struct rev_info revs;
>  
>  static int bisect_list;
>  static int show_timestamp;
> -static int hdr_termination;
>  static const char *header_prefix;
>  
>  static void finish_commit(struct commit *commit);
>  static void show_commit(struct commit *commit)
>  {
> +	graph_show_commit(revs.graph);
> +
>  	if (show_timestamp)
>  		printf("%lu ", commit->date);
>  	if (header_prefix)
> @@ -96,9 +98,50 @@ static void show_commit(struct commit *commit)
>  		pretty_print_commit(revs.commit_format, commit,
>  				    &buf, revs.abbrev, NULL, NULL,
>  				    revs.date_mode, 0);
> -		if (buf.len)
> -			printf("%s%c", buf.buf, hdr_termination);
> +		if (revs.graph) {
> ...
> +		} else {
> +			if (buf.len) {
> +				fwrite(buf.buf, sizeof(char), buf.len, stdout);
> +				putchar('\n');

Now hdr_termination can never be NUL, iow you broke "rev-list -v -z"?

I'll squash in a minimum fix, because otherwise this breaks existing
tests.

--

 builtin-rev-list.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index f868290..54d55cc 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -53,6 +53,7 @@ static struct rev_info revs;
 
 static int bisect_list;
 static int show_timestamp;
+static int hdr_termination;
 static const char *header_prefix;
 
 static void finish_commit(struct commit *commit);
@@ -133,10 +134,8 @@ static void show_commit(struct commit *commit)
 					putchar('\n');
 			}
 		} else {
-			if (buf.len) {
-				fwrite(buf.buf, sizeof(char), buf.len, stdout);
-				putchar('\n');
-			}
+			if (buf.len)
+				printf("%s%c", buf.buf, hdr_termination);
 		}
 		strbuf_release(&buf);
 	} else {
@@ -635,6 +634,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 	}
 	if (revs.commit_format != CMIT_FMT_UNSPECIFIED) {
 		/* The command line has a --pretty  */
+		hdr_termination = '\n';
 		if (revs.commit_format == CMIT_FMT_ONELINE)
 			header_prefix = "";
 		else

  parent reply	other threads:[~2008-05-06  6:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-04 10:36 [PATCH 0/3] log --graph and rev-list --graph Adam Simpkins
2008-05-04 10:36 ` [PATCH 1/3] revision API: split parent rewriting and parent printing options Adam Simpkins
2008-05-04 10:36   ` [PATCH 2/3] Add history graph API Adam Simpkins
2008-05-04 10:36     ` [PATCH 3/3] log and rev-list: add --graph option Adam Simpkins
2008-05-05  7:57       ` [PATCH] graph API: eliminate unnecessary indentation Adam Simpkins
2008-05-05 11:38         ` Ping Yin
2008-05-06  6:41       ` Junio C Hamano [this message]
2008-05-06  7:01         ` [PATCH 3/3] log and rev-list: add --graph option Adam Simpkins
2008-05-06  6:41     ` [PATCH 2/3] Add history graph API Junio C Hamano
2008-05-04 11:06 ` [PATCH] bash: Add more option completions for 'git log' Teemu Likonen
2008-05-05  2:13 ` [PATCH 0/3] log --graph and rev-list --graph Ping Yin
2008-05-05  6:19   ` Adam Simpkins
2008-05-06 19:03 ` Teemu Likonen

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=7vtzhcgci1.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=adam@adamsimpkins.net \
    --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).