* [PATCH] Do not drop data from '\0' until eol in patch output
@ 2006-07-07 10:33 Stephan Feder
2006-07-07 10:52 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Stephan Feder @ 2006-07-07 10:33 UTC (permalink / raw)
To: git
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>
---
diff.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/diff.c b/diff.c
index 507e401..f0450a8 100644
--- a/diff.c
+++ b/diff.c
@@ -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)
--
1.4.1.gbc483
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Do not drop data from '\0' until eol in patch output
2006-07-07 10:33 [PATCH] Do not drop data from '\0' until eol in patch output Stephan Feder
@ 2006-07-07 10:52 ` Junio C Hamano
2006-07-07 11:18 ` sf
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2006-07-07 10:52 UTC (permalink / raw)
To: Stephan Feder; +Cc: git
Stephan Feder <sf@b-i-t.de> writes:
> 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>
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?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Do not drop data from '\0' until eol in patch output
2006-07-07 10:52 ` Junio C Hamano
@ 2006-07-07 11:18 ` sf
2006-07-07 12:03 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: sf @ 2006-07-07 11:18 UTC (permalink / raw)
To: git
Junio C Hamano wrote:
> Stephan Feder <sf@b-i-t.de> writes:
>
>> 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>
>
> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Do not drop data from '\0' until eol in patch output
2006-07-07 11:18 ` sf
@ 2006-07-07 12:03 ` Junio C Hamano
0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2006-07-07 12:03 UTC (permalink / raw)
To: sf; +Cc: git
sf <sf@b-i-t.de> writes:
> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-07-07 12:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-07 10:33 [PATCH] Do not drop data from '\0' until eol in patch output Stephan Feder
2006-07-07 10:52 ` Junio C Hamano
2006-07-07 11:18 ` sf
2006-07-07 12:03 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).