{"thread":{"id":"35835","subject":"Bug: Problem with CRLF line ending in git-diff with coloring","startedAt":"2014-02-09T11:01:55Z","lastAt":"2014-02-15T07:21:58Z","messageCount":6,"participants":["Stefan-W. Hahn","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"234542","messageId":"20140209110155.GB16189@scotty.home","threadId":"35835","inReplyTo":null,"subject":"Bug: Problem with CRLF line ending in git-diff with coloring","fromName":"Stefan-W. Hahn","fromEmail":"stefan.hahn@s-hahn.de","sentAt":"2014-02-09T11:01:55Z","receivedAt":"2014-02-09T11:01:55Z","isPatch":false,"sender":{"key":"stefan.hahn@s-hahn.de","avatar":null},"body":"Good morning,\n\nwhen diffing output where files have CRLF line ending, the coloring\nseems wrong, because in changed lines the CR (^M) is highlighted,\neven if the line ending has not changed.\n\nThe diff engine itself is correct.\n\nI added a test case to show this behaviour.\n\nThe problem seems to come from emit_add_line() where ws_check_emit() is\ncalled.  The parameter ecbdata->ws_rule has not set WS_CR_AT_EOL. In this\ncase ws_check_emit() handles the CR at eol as whitespace character and\ntherfore highlights it. This seems wrong for files with CRLF lineending.\n\n,----\n| static void emit_add_line(const char *reset,\n| \t\t\t  struct emit_callback *ecbdata,\n| \t\t\t  const char *line, int len)\n| {\n|         const char *ws = diff_get_color(ecbdata->color_diff, DIFF_WHITESPACE);\n|         ...\n|         \n| \tif (!*ws)\n|         ...\n| \telse {\n| \t\t/* Emit just the prefix, then the rest. */\n| \t\temit_line_0(ecbdata->opt, set, reset, '+', \"\", 0);\n| \t\tws_check_emit(line, len, ecbdata->ws_rule,\n| \t\t\t      ecbdata->opt->file, set, reset, ws);\n| \t}\n| }\n`----\n\nIf WS_CR_AT_EOL is set in ecbdata->ws_rule, it works correctly, but this seems\nnot the right solutions. (Sorry, but I'm not deep enough in the code to\npropose a solution.)\n\nAnother nitpick: While writing the test it was unclear for me where the color\nstart and end sequences will be put. Here is a difference between old lines and\nnew lines, because old lines will be printed with emit_line_0() and new lines\nwith emit_line_0() + ws_check_emit(). So in case of new lines the \"+\" itself\nis enclosed by the color sequences, where in case of the old lines the whole\nline is enclosed by the color sequences.\n\nI tested this with 6a7071958620dad (Git 1.9.0-rc3), but this is also wrong\nin older versions.\n\nWith kind regards,\nStefan\n\n---\n t/t4060-diff-eol.sh | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 81 insertions(+), 0 deletion(-)\n create mode 100755 t/t4060-diff-eol.sh\n\ndiff --git a/t/t4060-diff-eol.sh b/t/t4060-diff-eol.sh\nnew file mode 100755\nindex 0000000..8cf9a69\n--- /dev/null\n+++ b/t/t4060-diff-eol.sh\n@@ -0,0 +1,81 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2014 Stefan-W. Hahn\n+#\n+\n+test_description='Test coloring of diff with CRLF line ending.\n+\n+'\n+. ./test-lib.sh\n+\n+get_color ()\n+{\n+\tgit config --get-color \"$1\"\n+}\n+\n+tr 'Q' '\\015' << EOF > x\n+Zeile 1Q\n+Zeile 2Q\n+Zeile 3Q\n+EOF\n+\n+git update-index --add x\n+\n+tr 'Q' '\\015' << EOF > x\n+Zeile 1Q\n+Zeile 22Q\n+Zeile 3Q\n+EOF\n+\n+tr 'Q' '\\015' << EOF > expect\n+diff --git a/x b/x\n+index 3411cc1..68a4b2c 100644\n+--- a/x\n++++ b/x\n+@@ -1,3 +1,3 @@\n+ Zeile 1Q\n+-Zeile 2Q\n++Zeile 22Q\n+ Zeile 3Q\n+EOF\n+\n+\n+git -c color.diff=false diff > out\n+test_expect_success \"diff files ending with CRLF without color\" '\n+        test_cmp expect out'\n+\n+test_expect_success setup '\n+        git config color.diff.plain black &&\n+        git config color.diff.meta blue &&\n+        git config color.diff.frag yellow &&\n+        git config color.diff.func normal &&\n+        git config color.diff.old red &&\n+        git config color.diff.new green &&\n+        git config color.diff.commit normal &&\n+\tc_reset=$(git config --get-color no.such.color reset) &&\n+\tc_plain=$(get_color color.diff.plain) &&\n+\tc_meta=$(get_color color.diff.meta) &&\n+\tc_frag=$(get_color color.diff.frag) &&\n+\tc_func=$(get_color color.diff.func) &&\n+\tc_old=$(get_color color.diff.old) &&\n+\tc_new=$(get_color color.diff.new) &&\n+\tc_commit=$(get_color color.diff.commit) &&\n+\tc_whitespace=$(get_color color.diff.whitespace)\n+'\n+\n+tr 'Q' '\\015' << EOF > expect\n+${c_meta}diff --git a/x b/x${c_reset}\n+${c_meta}index 3411cc1..68a4b2c 100644${c_reset}\n+${c_meta}--- a/x${c_reset}\n+${c_meta}+++ b/x${c_reset}\n+${c_frag}@@ -1,3 +1,3 @@${c_reset}\n+${c_plain} Zeile 1${c_reset}Q\n+${c_old}-Zeile 2${c_reset}Q\n+${c_new}+${c_reset}${c_new}Zeile 22${c_reset}Q\n+${c_plain} Zeile 3${c_reset}Q\n+EOF\n+\n+git -c color.diff=always diff > out\n+test_expect_success \"diff files ending with CRLF with color coding\" 'test_cmp expect out'\n+\n+test_done\n-- \n1.8.3.2.733.gf8abaeb\n\n\n\n-- \nStefan-W. Hahn                          It is easy to make things.\n                                        It is hard to make things simple.\n"},{"id":"234552","messageId":"52F7C956.5040604@kdbg.org","threadId":"35835","inReplyTo":"20140209110155.GB16189@scotty.home","subject":"Re: Bug: Problem with CRLF line ending in git-diff with coloring","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2014-02-09T18:30:46Z","receivedAt":"2014-02-09T18:30:46Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 09.02.2014 12:01, schrieb Stefan-W. Hahn:\n> Good morning,\n> \n> when diffing output where files have CRLF line ending, the coloring\n> seems wrong, because in changed lines the CR (^M) is highlighted,\n> even if the line ending has not changed.\n...\n> If WS_CR_AT_EOL is set in ecbdata->ws_rule, it works correctly, but this seems\n> not the right solutions.\n\nIt's the right solution. IOW, you should place something like this in\nyour .gitattributes:\n\n  *.html whitespace=cr-at-eol\n\n-- Hannes\n"},{"id":"234776","messageId":"20140214164709.GI7560@pille.home","threadId":"35835","inReplyTo":"20140209110155.GB16189@scotty.home","subject":"Re: Bug: Problem with CRLF line ending in git-diff with coloring","fromName":"Stefan-W. Hahn","fromEmail":"stefan.hahn@s-hahn.de","sentAt":"2014-02-14T16:47:09Z","receivedAt":"2014-02-14T16:47:09Z","isPatch":false,"sender":{"key":"stefan.hahn@s-hahn.de","avatar":null},"body":"Mail von Stefan-W. Hahn, Sun, 09 Feb 2014 at 12:01:55 +0100:\n\nGood afternoon,\n\nI updated the test a little bit. Test 3 and 7 are going wrong.\nBoth tests have a CRLF line ending in the changed line.\n\nI you redirect the output of the test to a file you see the main\nproblem:\n\n,----\n| -\u001b[32m+\u001b[m\u001b[32mZeile 22\u001b[m\u001b[32m\r\u001b[m\n| +\u001b[32m+\u001b[m\u001b[32mZeile 22\u001b[m\u001b[41m\r\u001b[m\n`----\n\n> It's the right solution. IOW, you should place something like this in\n> your .gitattributes:\n>  *.html whitespace=cr-at-eol\n\nSorry, but this is not possible, because I have files of both sorts (mainly\nC/C++) files in my repository and cannot change the files as I wish.\n\nWith kind regards,\nStefan\n\n-- \nStefan-W. Hahn                          It is easy to make things.\n                                        It is hard to make things simple.\n"},{"id":"234811","messageId":"20140214211712.GJ7560@pille.home","threadId":"35835","inReplyTo":"20140209110155.GB16189@scotty.home","subject":"Re: Bug: Problem with CRLF line ending in git-diff with coloring","fromName":"Stefan-W. Hahn","fromEmail":"stefan.hahn@s-hahn.de","sentAt":"2014-02-14T21:17:13Z","receivedAt":"2014-02-14T21:17:13Z","isPatch":false,"sender":{"key":"stefan.hahn@s-hahn.de","avatar":null},"body":"Mail von Stefan-W. Hahn, Sun, 09 Feb 2014 at 12:01:55 +0100:\n\nGood afternoon,\n\nI updated the test a little bit. Test 3 and 7 are going wrong.\nBoth tests have a CRLF line ending in the changed line.\n\nI you redirect the output of the test to a file you see the main\nproblem:\n\n,----\n| -\u001b[32m+\u001b[m\u001b[32mZeile 22\u001b[m\u001b[32m\n\u001b[m\n| +\u001b[32m+\u001b[m\u001b[32mZeile 22\u001b[m\u001b[41m\n\u001b[m\n`----\n\n> It's the right solution. IOW, you should place something like this in\n> your .gitattributes:\n>  *.html whitespace=cr-at-eol\n\nSorry, but this is not possible, because I have files of both sorts (mainly\nC/C++) files in my repository and cannot change the files as I wish.\n\nSecond try, the mail was blocked because of the attachment blocked the mail,\nso not as attachment.\n\n,----\n| Date: Fri, 14 Feb 2014 11:50:37 -0500\n| From: Administrator <scanmail@arrisi.com>\n| To: stefan.hahn@s-hahn.de\n| Subject: [MailServer Notification]Attachment Blocking Notification\n| From prvs=81222a4311=scanmail@arrisi.com  Fri Feb 14 22:03:58 2014\n| X-Mailer: Microsoft CDO for Windows 2000\n| \n| The t4060-diff-eol.sh has been blocked since it violated the Microsoft\n| Exchange attachment policy and Replace with text/file has been taken on\n| 2/14/2014 11:49:56 AM.\n| Please zip the attachment and send it again. If you have any questions,\n| please contact IT. Thank you\n| \n| Message details:\n| Server: ATLOWA1\n| Sender: stefan.hahn@s-hahn.de;\n| Recipient: git@vger.kernel.org;\n| Subject: Re: Bug: Problem with CRLF line ending in git-diff with coloring\n| Attachment name: t4060-diff-eol.sh\n| ~\n`----\n\n\nWith kind regards,\nStefan\n\n#!/bin/sh\n#\n# Copyright (c) 2014 Stefan-W. Hahn\n#\n\ntest_description='Test coloring of diff with CRLF line ending.\n\n'\n. ./test-lib.sh\n\nget_color ()\n{\n\tgit config --get-color \"$1\"\n}\n\ntest_expect_success setup '\n        git config color.diff.plain black &&\n        git config color.diff.meta blue &&\n        git config color.diff.frag yellow &&\n        git config color.diff.func normal &&\n        git config color.diff.old red &&\n        git config color.diff.new green &&\n        git config color.diff.commit normal &&\n\tc_reset=$(git config --get-color no.such.color reset) &&\n\tc_plain=$(get_color color.diff.plain) &&\n\tc_meta=$(get_color color.diff.meta) &&\n\tc_frag=$(get_color color.diff.frag) &&\n\tc_func=$(get_color color.diff.func) &&\n\tc_old=$(get_color color.diff.old) &&\n\tc_new=$(get_color color.diff.new) &&\n\tc_commit=$(get_color color.diff.commit) &&\n\tc_whitespace=$(get_color color.diff.whitespace)\n'\n\n# Test cases\n# - DOS line ending\n#   - change one line\n#   - change one line ending to UNIX\n# - UNIX line ending\n#   - change one line (trivial not tested here)\n#   - change one line ending to DOS\n\ntr 'Q' '\\015' << EOF > x\nZeile 1Q\nZeile 2Q\nZeile 3Q\nEOF\n\ngit update-index --add x\n\ntr 'Q' '\\015' << EOF > x\nZeile 1Q\nZeile 22Q\nZeile 3Q\nEOF\n\ntr 'Q' '\\015' << EOF > expect\ndiff --git a/x b/x\nindex 3411cc1..68a4b2c 100644\n--- a/x\n+++ b/x\n@@ -1,3 +1,3 @@\n Zeile 1Q\n-Zeile 2Q\n+Zeile 22Q\n Zeile 3Q\nEOF\n\ntr 'Q' '\\015' << EOF > expect_color\n${c_meta}diff --git a/x b/x${c_reset}\n${c_meta}index 3411cc1..68a4b2c 100644${c_reset}\n${c_meta}--- a/x${c_reset}\n${c_meta}+++ b/x${c_reset}\n${c_frag}@@ -1,3 +1,3 @@${c_reset}\n${c_plain} Zeile 1${c_reset}Q\n${c_old}-Zeile 2${c_reset}Q\n${c_new}+${c_reset}${c_new}Zeile 22${c_reset}${c_new}Q${c_reset}\n${c_plain} Zeile 3${c_reset}Q\nEOF\n\ngit -c color.diff=false diff > out\ntest_expect_success \"diff files: change line in DOS file without color\" '\n        test_cmp expect out'\n\ngit -c color.diff=always diff > out\ntest_expect_success \"diff files: change line in DOS file with color\" '\n        test_cmp expect_color out'\n\n\ntr 'Q' '\\015' << EOF > x\nZeile 1Q\nZeile 2Q\nZeile 3Q\nEOF\n\ngit update-index --add x\n\ntr 'Q' '\\015' << EOF > x\nZeile 1Q\nZeile 2\nZeile 3Q\nEOF\n\ntr 'Q' '\\015' << EOF > expect\ndiff --git a/x b/x\nindex 3411cc1..c040c67 100644\n--- a/x\n+++ b/x\n@@ -1,3 +1,3 @@\n Zeile 1Q\n-Zeile 2Q\n+Zeile 2\n Zeile 3Q\nEOF\n\ntr 'Q' '\\015' << EOF > expect_color\n${c_meta}diff --git a/x b/x${c_reset}\n${c_meta}index 3411cc1..c040c67 100644${c_reset}\n${c_meta}--- a/x${c_reset}\n${c_meta}+++ b/x${c_reset}\n${c_frag}@@ -1,3 +1,3 @@${c_reset}\n${c_plain} Zeile 1${c_reset}Q\n${c_old}-Zeile 2${c_reset}Q\n${c_new}+${c_reset}${c_new}Zeile 2${c_reset}\n${c_plain} Zeile 3${c_reset}Q\nEOF\n\ngit -c color.diff=false diff > out\ntest_expect_success \"diff files: change line ending in DOS file to LF ending without color\" '\n        test_cmp expect out'\n\ngit -c color.diff=always diff > out\ntest_expect_success \"diff files: change line ending in DOS file to LF ending with color\" '\n        test_cmp expect_color out'\n\ntr 'Q' '\\015' << EOF > x\nZeile 1\nZeile 2\nZeile 3\nEOF\n\ngit update-index --add x\n\ntr 'Q' '\\015' << EOF > x\nZeile 1\nZeile 2Q\nZeile 3\nEOF\n\ntr 'Q' '\\015' << EOF > expect\ndiff --git a/x b/x\nindex a385875..63416d7 100644\n--- a/x\n+++ b/x\n@@ -1,3 +1,3 @@\n Zeile 1\n-Zeile 2\n+Zeile 2Q\n Zeile 3\nEOF\n\ntr 'Q' '\\015' << EOF > expect_color\n${c_meta}diff --git a/x b/x${c_reset}\n${c_meta}index a385875..63416d7 100644${c_reset}\n${c_meta}--- a/x${c_reset}\n${c_meta}+++ b/x${c_reset}\n${c_frag}@@ -1,3 +1,3 @@${c_reset}\n${c_plain} Zeile 1${c_reset}\n${c_old}-Zeile 2${c_reset}\n${c_new}+${c_reset}${c_new}Zeile 2${c_reset}${c_new}Q${c_reset}\n${c_plain} Zeile 3${c_reset}\nEOF\n\ngit -c color.diff=false diff > out\ntest_expect_success \"diff files: change line ending in UNIX file to CRLF ending without color\" '\n        test_cmp expect out'\n\ngit -c color.diff=always diff > out\ntest_expect_success \"diff files: change line ending in UNIX file to CRLF ending with color\" '\n        test_cmp expect_color out'\n\ntest_done\n\n\n-- \nStefan-W. Hahn                          It is easy to make things.\n                                        It is hard to make things simple.\n"},{"id":"234812","messageId":"52FE8847.8020101@kdbg.org","threadId":"35835","inReplyTo":"20140214164709.GI7560@pille.home","subject":"Re: Bug: Problem with CRLF line ending in git-diff with coloring","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2014-02-14T21:19:03Z","receivedAt":"2014-02-14T21:19:03Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 14.02.2014 17:47, schrieb Stefan-W. Hahn:\n>> It's the right solution. IOW, you should place something like this in\n>> your .gitattributes:\n>>  *.html whitespace=cr-at-eol\n> \n> Sorry, but this is not possible, because I have files of both sorts (mainly\n> C/C++) files in my repository and cannot change the files as I wish.\n\nI'm confused. This setting does not change your files, but instructs git\ndiff and git apply to not report the trailing CR as white-space error.\nDidn't you try it?\n\n-- Hannes\n"},{"id":"234842","messageId":"20140215072158.GK7560@pille.home","threadId":"35835","inReplyTo":"52FE8847.8020101@kdbg.org","subject":"Re: Bug: Problem with CRLF line ending in git-diff with coloring","fromName":"Stefan-W. Hahn","fromEmail":"stefan.hahn@s-hahn.de","sentAt":"2014-02-15T07:21:58Z","receivedAt":"2014-02-15T07:21:58Z","isPatch":false,"sender":{"key":"stefan.hahn@s-hahn.de","avatar":null},"body":"Mail von Johannes Sixt, Fri, 14 Feb 2014 at 22:19:03 +0100:\n\nGood morning,\n\n> Am 14.02.2014 17:47, schrieb Stefan-W. Hahn:\n> >> It's the right solution. IOW, you should place something like this in\n> >> your .gitattributes:\n> >>  *.html whitespace=cr-at-eol\n> > \n> > Sorry, but this is not possible, because I have files of both sorts (mainly\n> > C/C++) files in my repository and cannot change the files as I wish.\n> \n> I'm confused. This setting does not change your files, but instructs git\n> diff and git apply to not report the trailing CR as white-space error.\n> Didn't you try it?\n\nYou are right, if I configure\n\n        git config core.whitespace cr-at-eol\n\nthen the CR is not highlighted.\n\nI try to work with it; I hope there are no other traps with it.\n\nI changed the test to regard this, here it is.\n\nWith kind regards,\nStefan\n\n#!/bin/sh\n#\n# Copyright (c) 2014 Stefan-W. Hahn\n#\n\ntest_description='Test coloring of diff with CRLF line ending.\n\n'\n. ./test-lib.sh\n\nget_color ()\n{\n\tgit config --get-color \"$1\"\n}\n\ntest_expect_success setup '\n        git config color.diff.plain black &&\n        git config color.diff.meta blue &&\n        git config color.diff.frag yellow &&\n        git config color.diff.func normal &&\n        git config color.diff.old red &&\n        git config color.diff.new green &&\n        git config color.diff.commit normal &&\n\tc_reset=$(git config --get-color no.such.color reset) &&\n\tc_plain=$(get_color color.diff.plain) &&\n\tc_meta=$(get_color color.diff.meta) &&\n\tc_frag=$(get_color color.diff.frag) &&\n\tc_func=$(get_color color.diff.func) &&\n\tc_old=$(get_color color.diff.old) &&\n\tc_new=$(get_color color.diff.new) &&\n\tc_commit=$(get_color color.diff.commit) &&\n\tc_whitespace=$(get_color color.diff.whitespace)\n'\n\n# Test cases\n# - DOS line ending\n#   - change one line\n#   - change one line ending to UNIX\n# - UNIX line ending\n#   - change one line (trivial not tested here)\n#   - change one line ending to DOS\n\ntr 'Q' '\\015' << EOF > x\nZeile 1Q\nZeile 2Q\nZeile 3Q\nEOF\n\ngit update-index --add x\n\ntr 'Q' '\\015' << EOF > x\nZeile 1Q\nZeile 22Q\nZeile 3Q\nEOF\n\ntr 'Q' '\\015' << EOF > expect\ndiff --git a/x b/x\nindex 3411cc1..68a4b2c 100644\n--- a/x\n+++ b/x\n@@ -1,3 +1,3 @@\n Zeile 1Q\n-Zeile 2Q\n+Zeile 22Q\n Zeile 3Q\nEOF\n\ntr 'Q' '\\015' << EOF > expect_color\n${c_meta}diff --git a/x b/x${c_reset}\n${c_meta}index 3411cc1..68a4b2c 100644${c_reset}\n${c_meta}--- a/x${c_reset}\n${c_meta}+++ b/x${c_reset}\n${c_frag}@@ -1,3 +1,3 @@${c_reset}\n${c_plain} Zeile 1${c_reset}Q\n${c_old}-Zeile 2${c_reset}Q\n${c_new}+${c_reset}${c_new}Zeile 22${c_reset}Q\n${c_plain} Zeile 3${c_reset}Q\nEOF\n\ngit -c color.diff=false diff > out\ntest_expect_success \"diff files: change line in DOS file without color\" '\n        test_cmp expect out'\n\ngit -c color.diff=always -c core.whitespace=cr-at-eol diff > out\ntest_expect_success \"diff files: change line in DOS file with color\" '\n        test_cmp expect_color out'\n\n\ntr 'Q' '\\015' << EOF > x\nZeile 1Q\nZeile 2Q\nZeile 3Q\nEOF\n\ngit update-index --add x\n\ntr 'Q' '\\015' << EOF > x\nZeile 1Q\nZeile 2\nZeile 3Q\nEOF\n\ntr 'Q' '\\015' << EOF > expect\ndiff --git a/x b/x\nindex 3411cc1..c040c67 100644\n--- a/x\n+++ b/x\n@@ -1,3 +1,3 @@\n Zeile 1Q\n-Zeile 2Q\n+Zeile 2\n Zeile 3Q\nEOF\n\ntr 'Q' '\\015' << EOF > expect_color\n${c_meta}diff --git a/x b/x${c_reset}\n${c_meta}index 3411cc1..c040c67 100644${c_reset}\n${c_meta}--- a/x${c_reset}\n${c_meta}+++ b/x${c_reset}\n${c_frag}@@ -1,3 +1,3 @@${c_reset}\n${c_plain} Zeile 1${c_reset}Q\n${c_old}-Zeile 2${c_reset}Q\n${c_new}+${c_reset}${c_new}Zeile 2${c_reset}\n${c_plain} Zeile 3${c_reset}Q\nEOF\n\ngit -c color.diff=false diff > out\ntest_expect_success \"diff files: change line ending in DOS file to LF ending without color\" '\n        test_cmp expect out'\n\ngit -c color.diff=always diff > out\ntest_expect_success \"diff files: change line ending in DOS file to LF ending with color\" '\n        test_cmp expect_color out'\n\ntr 'Q' '\\015' << EOF > x\nZeile 1\nZeile 2\nZeile 3\nEOF\n\ngit update-index --add x\n\ntr 'Q' '\\015' << EOF > x\nZeile 1\nZeile 2Q\nZeile 3\nEOF\n\ntr 'Q' '\\015' << EOF > expect\ndiff --git a/x b/x\nindex a385875..63416d7 100644\n--- a/x\n+++ b/x\n@@ -1,3 +1,3 @@\n Zeile 1\n-Zeile 2\n+Zeile 2Q\n Zeile 3\nEOF\n\ntr 'Q' '\\015' << EOF > expect_color\n${c_meta}diff --git a/x b/x${c_reset}\n${c_meta}index a385875..63416d7 100644${c_reset}\n${c_meta}--- a/x${c_reset}\n${c_meta}+++ b/x${c_reset}\n${c_frag}@@ -1,3 +1,3 @@${c_reset}\n${c_plain} Zeile 1${c_reset}\n${c_old}-Zeile 2${c_reset}\n${c_new}+${c_reset}${c_new}Zeile 2${c_reset}Q\n${c_plain} Zeile 3${c_reset}\nEOF\n\ngit -c color.diff=false diff > out\ntest_expect_success \"diff files: change line ending in UNIX file to CRLF ending without color\" '\n        test_cmp expect out'\n\ngit -c color.diff=always -c core.whitespace=cr-at-eol diff > out\ntest_expect_success \"diff files: change line ending in UNIX file to CRLF ending with color\" '\n        test_cmp expect_color out'\n\ntest_done\n\n\n-- \nStefan-W. Hahn                          It is easy to make things.\n                                        It is hard to make things simple.\n"}]}