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. Signed-off-by: Stephan Feder <sf@b-i-t.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Stephan Feder committed
Jul 7, 2006 at 12:33 UTC
c9c95bbc9c9f7b8a3c87ab486b4aec220a239577
1 file changed
+3
-1
diff.c
+3
-1
@@ -329,7 +329,9 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
329
}
330
if (len > 0 && line[len-1] == '\n')
331
len--;
332
- printf("%s%.*s%s\n", set, (int) len, line, reset);
332
+ fputs (set, stdout);
333
+ fwrite (line, len, 1, stdout);
334
+ puts (reset);
335
}
336
337
static char *pprint_rename(const char *a, const char *b)