git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Do not drop data from '\0' until eol in patch output

From
SFStephan Feder <sf@b-i-t.de>
Date
Jul 7, 2006, 10:33 UTC
Message-ID
<1152268424350-git-send-email-sf@b-i-t.de>

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
Next: Junio C Hamano
Message 1 of 4 in “Do not drop data from '\0' until eol in patch output”
  1. Do not drop data from '\0' until eol in patch outputStephan Feder, Jul 7, 2006
  2. Junio C HamanoJul 7, 2006
  3. sfJul 7, 2006
  4. Junio C HamanoJul 7, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.