Do not drop data from '\0' until eol in patch output
PATCH 1/1 Do not drop data from '\0' until eol in patch output
The binary file detection is just a heuristic which can well fail. Do not produce garbage patches in these cases.
--- diff.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff.c +3 -1
@@ -329,7 +329,9 @@ static void fn_out_consume(void *priv, c }if (len >0 && line[len-1 ] =='\n' ) len--; -printf ("%s%.*s%s\n" , set, (int ) len, line, reset); +fputs (set, stdout); +fwrite (line, len,1 , stdout); +puts (reset); }static char *pprint_rename (const char *a,const char *b)
Signature · 1 line
1.4.1.gbc483
Quoted 4 lines · Stephan Feder
The binary file detection is just a heuristic which can well fail. Do not produce garbage patches in these cases.
Signed-off-by Stephan Feder <[email protected]>
Thanks.
I do not think this patch is _wrong_ per se, but I wonder what you would use a patch like that for. Specifically, do you apply such a patch with NUL and other binary data in it, and if so what tool do you use?
Quoted 5 lines · Junio C Hamano
Quoted 3 lines · Stephan Feder
The binary file detection is just a heuristic which can well fail. Do not produce garbage patches in these cases.
Quoted 9 lines
Quoted 1 line
Signed-off-by Stephan Feder <[email protected]>Thanks.
I do not think this patch is _wrong_ per se, but I wonder what you would use a patch like that for. Specifically, do you apply such a patch with NUL and other binary data in it, and if so what tool do you use?
GNU patch can apply patches with binary content which are typically produced with GNU diff with --text option.
Quoted 2 lines · sf
GNU patch can apply patches with binary content which are typically produced with GNU diff with --text option.
Hmph. Things must have improved since I looked at it the last time, perhaps 6-7 years ago. I remember that I used "diff -a -u0" as an el-cheapo way to deliber binary contents but found that patch sometimes could not grok such, and ended up writing a small customized C program.