Skip to content

Commit c9c95bb

Browse files
Stephan FederJunio C Hamano
authored andcommitted
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>
1 parent 97beb81 commit c9c95bb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

diff.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,9 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
329329
}
330330
if (len > 0 && line[len-1] == '\n')
331331
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);
333335
}
334336

335337
static char *pprint_rename(const char *a, const char *b)

0 commit comments

Comments
 (0)