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@xxxxxxxxxxxx> --- 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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html