git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xdiff-interface.c (buffer_is_binary): Remove buffer size limitation
@ 2007-12-01 16:01 Dmitry V. Levin
  2007-12-01 19:46 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry V. Levin @ 2007-12-01 16:01 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano

When checking buffer for NUL byte, do not limit size of buffer we check.
Otherwise we break git-rebase: git-format-patch may generate output which
git-mailinfo cannot handle properly.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 t/t3407-rebase-binary.sh |   32 ++++++++++++++++++++++++++++++++
 xdiff-interface.c        |    3 ---
 2 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100755 t/t3407-rebase-binary.sh

diff --git a/t/t3407-rebase-binary.sh b/t/t3407-rebase-binary.sh
new file mode 100755
index 0000000..213dc9d
--- /dev/null
+++ b/t/t3407-rebase-binary.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+test_description='rebase binary test'
+
+. ./test-lib.sh
+
+yes 1234567 |head -n 2003 >text
+yes 1234567 |head -n 2000 >bin && printf 'binary\0bin\n' >>bin && yes 1234567 |head -n 3 >>bin
+
+test_expect_success setup '
+
+	cat text >file &&
+	git add file &&
+	git commit -m"text" &&
+
+	git branch bin &&
+
+	echo side >side &&
+	git add side &&
+	git commit -m"side" &&
+
+	git checkout bin &&
+	cat bin >file &&
+	git commit -a -m"bin"
+'
+
+test_expect_success rebase '
+
+	git rebase master
+'
+
+test_done
diff --git a/xdiff-interface.c b/xdiff-interface.c
index be866d1..fa9f58d 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -122,11 +122,8 @@ int read_mmfile(mmfile_t *ptr, const char *filename)
 	return 0;
 }
 
-#define FIRST_FEW_BYTES 8000
 int buffer_is_binary(const char *ptr, unsigned long size)
 {
-	if (FIRST_FEW_BYTES < size)
-		size = FIRST_FEW_BYTES;
 	return !!memchr(ptr, 0, size);
 }
 
-- 
ldv

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-12-05 10:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-01 16:01 [PATCH] xdiff-interface.c (buffer_is_binary): Remove buffer size limitation Dmitry V. Levin
2007-12-01 19:46 ` Junio C Hamano
2007-12-03 21:50   ` Dmitry V. Levin
2007-12-03 23:24     ` Junio C Hamano
2007-12-04  0:00     ` Linus Torvalds
2007-12-04  1:00       ` Johannes Schindelin
2007-12-05 10:47         ` David Kastrup

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).