git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: [PATCH] Adjust diff-helper to diff-tree -v -z changes.
Date: Fri, 27 May 2005 21:05:38 -0700	[thread overview]
Message-ID: <7vvf54xael.fsf_-_@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vfyw8zg1w.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Fri, 27 May 2005 11:20:43 -0700")

The latest change to diff-tree -z output adds an extra line
termination after non diff-raw material (the header and the
commit message).  To compensate for this change, stop adding the
output termination of our own.  "diff-tree -v -z" piped to
"diff-helper -z" would give different result from "diff-tree -v"
piped to "diff-helper" without this change.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

diff-helper.c |    5 ++++-
1 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/diff-helper.c b/diff-helper.c
--- a/diff-helper.c
+++ b/diff-helper.c
@@ -15,6 +15,7 @@ static const char *diff_helper_usage =
 
 int main(int ac, const char **av) {
 	struct strbuf sb;
+	const char *garbage_flush_format;
 
 	strbuf_init(&sb);
 
@@ -30,6 +31,8 @@ int main(int ac, const char **av) {
 			usage(diff_helper_usage);
 		ac--; av++;
 	}
+	garbage_flush_format = (line_termination == 0) ? "%s" : "%s\n";
+
 	/* the remaining parameters are paths patterns */
 
 	diff_setup(0);
@@ -134,7 +137,7 @@ int main(int ac, const char **av) {
 		if (pickaxe)
 			diffcore_pickaxe(pickaxe, pickaxe_opts);
 		diff_flush(DIFF_FORMAT_PATCH, 0);
-		printf("%s\n", sb.buf);
+		printf(garbage_flush_format, sb.buf);
 	}
 	if (1 < ac)
 		diffcore_pathspec(av + 1);
------------------------------------------------


  reply	other threads:[~2005-05-28  4:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-27 13:20 [PATCH] Fix ptrdiff_t vs. int Markus F.X.J. Oberhumer
2005-05-27 13:51 ` Danjel McGougan
2005-05-27 14:02 ` Morten Welinder
2005-05-27 16:25 ` H. Peter Anvin
2005-05-27 17:18 ` Linus Torvalds
2005-05-27 17:25   ` Linus Torvalds
2005-05-27 17:42     ` Markus F.X.J. Oberhumer
2005-05-27 17:58       ` H. Peter Anvin
2005-05-27 18:13       ` Linus Torvalds
2005-05-27 18:20     ` Junio C Hamano
2005-05-28  4:05       ` Junio C Hamano [this message]
2005-05-29 18:31         ` [PATCH] Adjust diff-helper to diff-tree -v -z changes Linus Torvalds
2005-05-29 20:21           ` 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=7vvf54xael.fsf_-_@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.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).