From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>,
GIT <git@vger.kernel.org>
Subject: Re: git-diff-tree -z HEAD | git-diff-helper -z fails for me
Date: Mon, 23 May 2005 12:07:55 -0700 [thread overview]
Message-ID: <7v7jhp3gms.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vpsvh3hp0.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Mon, 23 May 2005 11:44:59 -0700")
>>>>> "JCH" == Junio C Hamano <junkio@cox.net> writes:
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> How about instead making sure that any "extra" text be NUL-terminated and
LT> never start with ':' after a NUL (which will automatically be true, since
LT> it's either "diff-tree " + ascii for the verbose case, or just the tree
LT> name).
JCH> Makes much more sense although it has certain amount of Yuck
JCH> factor ;-).
------------
NUL terminate diff-tree header lines under -z.
Thomas Glanzmann noticed that diff-tree -z HEAD piped to
diff-helper -z did not work. Since diff-helper -z expects NUL
terminated lines, we should generate such.
The output side of the diff-helper should always be using '\n'
termination; earlier it used the same line_termination used for
the input side, which was a mistake.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
*** Against your head, not my head that already has the
*** rename/copy fix.
*** Only rightly tested with the exact command line Thomas used.
cd /opt/packrat/playpen/public/in-place/git/git.junio/
jit-diff
# - linus: Don't care about st_dev in the index file
# + (working tree)
diff --git a/diff-helper.c b/diff-helper.c
--- a/diff-helper.c
+++ b/diff-helper.c
@@ -121,7 +121,7 @@ int main(int ac, const char **av) {
if (status) {
unrecognized:
diff_flush(diff_output_style);
- printf("%s%c", sb1.buf, line_termination);
+ printf("%s\n", sb1.buf);
}
}
if (detect_rename)
diff --git a/diff-tree.c b/diff-tree.c
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -277,7 +277,18 @@ static int call_diff_flush(void)
if (nr_paths)
diffcore_pathspec(paths);
if (header) {
- printf("%s", header);
+ if (diff_output_format == DIFF_FORMAT_MACHINE) {
+ const char *ep, *cp;
+ for (cp = header; *cp; cp = ep) {
+ ep = strchr(cp, '\n');
+ if (ep == 0) ep = cp + strlen(cp);
+ printf("%.*s%c", ep-cp, cp, 0);
+ if (*ep) ep++;
+ }
+ }
+ else {
+ printf("%s", header);
+ }
header = NULL;
}
diff_flush(diff_output_format);
next prev parent reply other threads:[~2005-05-23 19:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-23 9:02 git-diff-tree -z HEAD | git-diff-helper -z fails for me Thomas Glanzmann
2005-05-23 16:38 ` Junio C Hamano
2005-05-23 18:21 ` Linus Torvalds
2005-05-23 18:44 ` Junio C Hamano
2005-05-23 19:07 ` Junio C Hamano [this message]
2005-05-23 23:47 ` Linus Torvalds
2005-05-24 0:15 ` Junio C Hamano
2005-05-24 1:14 ` [PATCH] Fix diff-pruning logic which was running prune too early Junio C Hamano
2005-05-24 5:24 ` interim report on a big screwup with diff -M and -C Junio C Hamano
2005-05-24 8:10 ` [PATCH] Redo rename/copy detection logic 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=7v7jhp3gms.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=sithglan@stud.uni-erlangen.de \
--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 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.