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

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

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Oct 28, 2011, 18:36 UTC
Message-ID
<4EAAF63D.7050401@gmail.com>
In-Reply-To
<7vd3dht4ms.fsf@alter.siamese.dyndns.org>
On 28.10.2011 19:20, Junio C Hamano wrote:
Show 12 quoted lines
>>>>> 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
Previous: Junio C HamanoNext: Sebastian Schuberth
Message 7 of 8 in “blame.c: Properly initialize strbuf after calling, textconv_object()”
  1. blame.c: Properly initialize strbuf after calling, textconv_object()Sebastian Schuberth, Oct 28, 2011
  2. Junio C HamanoOct 28, 2011
  3. Sebastian SchuberthOct 28, 2011
  4. Junio C HamanoOct 28, 2011
  5. Sebastian SchuberthOct 28, 2011
  6. Junio C HamanoOct 28, 2011
  7. Sebastian SchuberthOct 28, 2011
  8. Sebastian SchuberthOct 31, 2011

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.