{"thread":{"id":"4793","subject":"[PATCH] Do not drop data from '\\0' until eol in patch output","startedAt":"2006-07-07T10:33:44Z","lastAt":"2006-07-07T12:03:18Z","messageCount":4,"participants":["Stephan Feder","Junio C Hamano","sf"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"23350","messageId":"1152268424350-git-send-email-sf@b-i-t.de","threadId":"4793","inReplyTo":null,"subject":"[PATCH] Do not drop data from '\\0' until eol in patch output","fromName":"Stephan Feder","fromEmail":"sf@b-i-t.de","sentAt":"2006-07-07T10:33:44Z","receivedAt":"2006-07-07T10:33:44Z","isPatch":true,"sender":{"key":"sf@b-i-t.de","avatar":null},"body":"The binary file detection is just a heuristic which can well fail.\nDo not produce garbage patches in these cases.\n\nSigned-off-by: Stephan Feder <sf@b-i-t.de>\n---\n diff.c |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 507e401..f0450a8 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -329,7 +329,9 @@ static void fn_out_consume(void *priv, c\n \t}\n \tif (len > 0 && line[len-1] == '\\n')\n \t\tlen--;\n-\tprintf(\"%s%.*s%s\\n\", set, (int) len, line, reset);\n+\tfputs (set, stdout);\n+\tfwrite (line, len, 1, stdout);\n+\tputs (reset);\n }\n \n static char *pprint_rename(const char *a, const char *b)\n-- \n1.4.1.gbc483\n"},{"id":"23353","messageId":"7vslld1ycq.fsf@assigned-by-dhcp.cox.net","threadId":"4793","inReplyTo":"1152268424350-git-send-email-sf@b-i-t.de","subject":"Re: [PATCH] Do not drop data from '\\0' until eol in patch output","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T10:52:05Z","receivedAt":"2006-07-07T10:52:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephan Feder <sf@b-i-t.de> writes:\n\n> The binary file detection is just a heuristic which can well fail.\n> Do not produce garbage patches in these cases.\n>\n> Signed-off-by: Stephan Feder <sf@b-i-t.de>\n\nThanks.\n\nI do not think this patch is _wrong_ per se, but I wonder what\nyou would use a patch like that for.  Specifically, do you apply\nsuch a patch with NUL and other binary data in it, and if so\nwhat tool do you use?\n"},{"id":"23358","messageId":"44AE431C.4090509@b-i-t.de","threadId":"4793","inReplyTo":"7vslld1ycq.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Do not drop data from '\\0' until eol in patch output","fromName":"sf","fromEmail":"sf@b-i-t.de","sentAt":"2006-07-07T11:18:52Z","receivedAt":"2006-07-07T11:18:52Z","isPatch":true,"sender":{"key":"sf@b-i-t.de","avatar":null},"body":"Junio C Hamano wrote:\n> Stephan Feder <sf@b-i-t.de> writes:\n> \n>> The binary file detection is just a heuristic which can well fail.\n>> Do not produce garbage patches in these cases.\n>>\n>> Signed-off-by: Stephan Feder <sf@b-i-t.de>\n> \n> Thanks.\n> \n> I do not think this patch is _wrong_ per se, but I wonder what\n> you would use a patch like that for.  Specifically, do you apply\n> such a patch with NUL and other binary data in it, and if so\n> what tool do you use?\n> \n\nGNU patch can apply patches with binary content which are typically\nproduced with GNU diff with --text option.\n"},{"id":"23364","messageId":"7vd5chzkop.fsf@assigned-by-dhcp.cox.net","threadId":"4793","inReplyTo":"44AE431C.4090509@b-i-t.de","subject":"Re: [PATCH] Do not drop data from '\\0' until eol in patch output","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-07T12:03:18Z","receivedAt":"2006-07-07T12:03:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"sf <sf@b-i-t.de> writes:\n\n> GNU patch can apply patches with binary content which are typically\n> produced with GNU diff with --text option.\n\nHmph.  Things must have improved since I looked at it the last\ntime, perhaps 6-7 years ago.  I remember that I used \"diff -a\n-u0\" as an el-cheapo way to deliber binary contents but found\nthat patch sometimes could not grok such, and ended up writing a\nsmall customized C program.\n"}]}