Subject: Re: [PATCH] blame.c: Properly initialize strbuf after calling, textconv_object()

From: Sebastian Schuberth <[email-masked]>
Date: Fri, 28 Oct 2011 20:36:45 +0200

On 28.10.2011 19:20, Junio C Hamano wrote:

>>>>> Thanks; do you have no addition to the test suite to demonstrate the
>>>>> breakage?
>>>>
>>>> Not yet. I'll try to come up with something.
>>>
>>> Let's do this.
>>
>> Thanks, but that does not seem to work for me. The test breaks both
>> without and with my patch. I'll look into it.
> 
> Thanks. I suspect the difference is because you are on a crlf-native
> platform while I am not...

I also didn't have any luck. I've created a test that should fail without my patch, but it succeeds when running the test script. However, if I copy and paste the lines from the test to the command line, the test fails as expected ("blame" is empty). I'm out of ideas right now.

diff --git a/t/t8006-blame-textconv.sh b/t/t8006-blame-textconv.sh
index 32ec82a..4fee5aa 100755
--- a/t/t8006-blame-textconv.sh
+++ b/t/t8006-blame-textconv.sh
@@ -14,6 +14,13 @@ sed 's/^bin: /converted: /' "$1"
 EOF
 chmod +x helper
 
+cat >helper-dos-line-endings <<'EOF'
+#!/bin/sh
+grep -q '^bin: ' "$1" || { echo "E: $1 is not \"binary\" file" 1>&2; exit 1; }
+sed 's/^bin: \(.*\)$/converted: \1\r/' "$1"
+EOF
+chmod +x helper-dos-line-endings
+
 test_expect_success 'setup ' '
 	echo "bin: test 1" >one.bin &&
 	echo "bin: test number 2" >two.bin &&
@@ -74,6 +81,14 @@ test_expect_success 'blame --textconv going through revisions' '
 	test_cmp expected result
 '
 
+test_expect_success 'blame --textconv with DOS line endings' '
+	git config diff.test.textconv ./helper-dos-line-endings &&
+	git blame --textconv two.bin >blame &&
+	git config diff.test.textconv ./helper &&
+	find_blame <blame >result &&
+	test_cmp expected result
+'
+
 test_expect_success 'setup +cachetextconv' '
 	git config diff.test.cachetextconv true
 '

-- 
Sebastian Schuberth