Skip to content

Commit

Permalink
Do not drop data from '\0' until eol in patch output
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephan Feder authored and Junio C Hamano committed Jul 7, 2006
1 parent 97beb81 commit c9c95bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
}
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)
Expand Down

0 comments on commit c9c95bb

Please sign in to comment.