(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'Test special whitespace in diff engine.\n'> <'\n'>)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_Name '$TEST_DIRECTORY')) (/diff-lib.sh)}) (C {(test_expect_success)} {(DQ ("Ray Lehtiniemi's example"))} { (SQ <'\n'> <'\tcat <<-\\EOF >x &&\n'> <'\tdo {\n'> <'\t nothing;\n'> <'\t} while (0);\n'> <'\tEOF\n'> <'\tgit update-index --add x &&\n'> <'\n'> <'\tcat <<-\\EOF >x &&\n'> <'\tdo\n'> <'\t{\n'> <'\t nothing;\n'> <'\t}\n'> <'\twhile (0);\n'> <'\tEOF\n'> <'\n'> <'\tcat <<-\\EOF >expect &&\n'> <'\tdiff --git a/x b/x\n'> <'\tindex adf3937..6edc172 100644\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -1,3 +1,5 @@\n'> <'\t-do {\n'> <'\t+do\n'> <'\t+{\n'> <'\t nothing;\n'> <'\t-} while (0);\n'> <'\t+}\n'> <'\t+while (0);\n'> <'\tEOF\n'> <'\n'> <'\tgit diff >out &&\n'> <'\ttest_cmp expect out &&\n'> <'\n'> <'\tgit diff -w >out &&\n'> <'\ttest_cmp expect out &&\n'> <'\n'> <'\tgit diff -b >out &&\n'> <'\ttest_cmp expect out\n'> ) } ) (C {(test_expect_success)} {(SQ <'another test, without options'>)} { (SQ <'\n'> <'\ttr Q "\\015" <<-\\EOF >x &&\n'> <'\twhitespace at beginning\n'> <'\twhitespace change\n'> <'\twhitespace in the middle\n'> <'\twhitespace at end\n'> <'\tunchanged line\n'> <'\tCR at endQ\n'> <'\tEOF\n'> <'\n'> <'\tgit update-index x &&\n'> <'\n'> <'\ttr "_" " " <<-\\EOF >x &&\n'> <'\t_\twhitespace at beginning\n'> <'\twhitespace \t change\n'> <'\twhite space in the middle\n'> <'\twhitespace at end__\n'> <'\tunchanged line\n'> <'\tCR at end\n'> <'\tEOF\n'> <'\n'> <'\ttr "Q_" "\\015 " <<-\\EOF >expect &&\n'> <'\tdiff --git a/x b/x\n'> <'\tindex d99af23..22d9f73 100644\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -1,6 +1,6 @@\n'> <'\t-whitespace at beginning\n'> <'\t-whitespace change\n'> <'\t-whitespace in the middle\n'> <'\t-whitespace at end\n'> <'\t+ \twhitespace at beginning\n'> <'\t+whitespace \t change\n'> <'\t+white space in the middle\n'> <'\t+whitespace at end__\n'> <'\t unchanged line\n'> <'\t-CR at endQ\n'> <'\t+CR at end\n'> <'\tEOF\n'> <'\n'> <'\tgit diff >out &&\n'> <'\ttest_cmp expect out &&\n'> <'\n'> <'\t>expect &&\n'> <'\tgit diff -w >out &&\n'> <'\ttest_cmp expect out &&\n'> <'\n'> <'\tgit diff -w -b >out &&\n'> <'\ttest_cmp expect out &&\n'> <'\n'> <'\tgit diff -w --ignore-space-at-eol >out &&\n'> <'\ttest_cmp expect out &&\n'> <'\n'> <'\tgit diff -w -b --ignore-space-at-eol >out &&\n'> <'\ttest_cmp expect out &&\n'> <'\n'> <'\n'> <'\ttr "Q_" "\\015 " <<-\\EOF >expect &&\n'> <'\tdiff --git a/x b/x\n'> <'\tindex d99af23..22d9f73 100644\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -1,6 +1,6 @@\n'> <'\t-whitespace at beginning\n'> <'\t+_\twhitespace at beginning\n'> <'\t whitespace \t change\n'> <'\t-whitespace in the middle\n'> <'\t+white space in the middle\n'> <'\t whitespace at end__\n'> <'\t unchanged line\n'> <'\t CR at end\n'> <'\tEOF\n'> <'\tgit diff -b >out &&\n'> <'\ttest_cmp expect out &&\n'> <'\n'> <'\tgit diff -b --ignore-space-at-eol >out &&\n'> <'\ttest_cmp expect out &&\n'> <'\n'> <'\ttr "Q_" "\\015 " <<-\\EOF >expect &&\n'> <'\tdiff --git a/x b/x\n'> <'\tindex d99af23..22d9f73 100644\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -1,6 +1,6 @@\n'> <'\t-whitespace at beginning\n'> <'\t-whitespace change\n'> <'\t-whitespace in the middle\n'> <'\t+_\twhitespace at beginning\n'> <'\t+whitespace \t change\n'> <'\t+white space in the middle\n'> <'\t whitespace at end__\n'> <'\t unchanged line\n'> <'\t CR at end\n'> <'\tEOF\n'> <'\tgit diff --ignore-space-at-eol >out &&\n'> <'\ttest_cmp expect out\n'> ) } ) (C {(test_expect_success)} {(SQ <'ignore-blank-lines: only new lines'>)} { (SQ <'\n'> <'\ttest_seq 5 >x &&\n'> <'\tgit update-index x &&\n'> <'\ttest_seq 5 | sed "/3/i\\\\\n'> <'" >x &&\n'> <'\tgit diff --ignore-blank-lines >out &&\n'> <'\t>expect &&\n'> <'\ttest_cmp out expect\n'> ) } ) (C {(test_expect_success)} {(SQ <'ignore-blank-lines: only new lines with space'>)} { (SQ <'\n'> <'\ttest_seq 5 >x &&\n'> <'\tgit update-index x &&\n'> <'\ttest_seq 5 | sed "/3/i\\\\\n'> <' " >x &&\n'> <'\tgit diff -w --ignore-blank-lines >out &&\n'> <'\t>expect &&\n'> <'\ttest_cmp out expect\n'> ) } ) (C {(test_expect_success)} {(SQ <'ignore-blank-lines: after change'>)} { (SQ <'\n'> <'\tcat <<-\\EOF >x &&\n'> <'\t1\n'> <'\t2\n'> <'\n'> <'\t3\n'> <'\t4\n'> <'\t5\n'> <'\n'> <'\t6\n'> <'\t7\n'> <'\tEOF\n'> <'\tgit update-index x &&\n'> <'\tcat <<-\\EOF >x &&\n'> <'\tchange\n'> <'\n'> <'\t1\n'> <'\t2\n'> <'\t3\n'> <'\t4\n'> <'\t5\n'> <'\t6\n'> <'\n'> <'\t7\n'> <'\tEOF\n'> <'\tgit diff --inter-hunk-context=100 --ignore-blank-lines >out.tmp &&\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tdiff --git a/x b/x\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -1,6 +1,7 @@\n'> <'\t+change\n'> <'\t+\n'> <'\t 1\n'> <'\t 2\n'> <'\t-\n'> <'\t 3\n'> <'\t 4\n'> <'\t 5\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected out.tmp\n'> ) } ) (C {(test_expect_success)} {(SQ <'ignore-blank-lines: before change'>)} { (SQ <'\n'> <'\tcat <<-\\EOF >x &&\n'> <'\t1\n'> <'\t2\n'> <'\n'> <'\t3\n'> <'\t4\n'> <'\t5\n'> <'\t6\n'> <'\t7\n'> <'\tEOF\n'> <'\tgit update-index x &&\n'> <'\tcat <<-\\EOF >x &&\n'> <'\n'> <'\t1\n'> <'\t2\n'> <'\t3\n'> <'\t4\n'> <'\t5\n'> <'\n'> <'\t6\n'> <'\t7\n'> <'\tchange\n'> <'\tEOF\n'> <'\tgit diff --inter-hunk-context=100 --ignore-blank-lines >out.tmp &&\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tdiff --git a/x b/x\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -4,5 +4,7 @@\n'> <'\t 3\n'> <'\t 4\n'> <'\t 5\n'> <'\t+\n'> <'\t 6\n'> <'\t 7\n'> <'\t+change\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected out.tmp\n'> ) } ) (C {(test_expect_success)} {(SQ <'ignore-blank-lines: between changes'>)} { (SQ <'\n'> <'\tcat <<-\\EOF >x &&\n'> <'\t1\n'> <'\t2\n'> <'\t3\n'> <'\t4\n'> <'\t5\n'> <'\n'> <'\n'> <'\t6\n'> <'\t7\n'> <'\t8\n'> <'\t9\n'> <'\t10\n'> <'\tEOF\n'> <'\tgit update-index x &&\n'> <'\tcat <<-\\EOF >x &&\n'> <'\tchange\n'> <'\t1\n'> <'\t2\n'> <'\n'> <'\t3\n'> <'\t4\n'> <'\t5\n'> <'\t6\n'> <'\t7\n'> <'\t8\n'> <'\n'> <'\t9\n'> <'\t10\n'> <'\tchange\n'> <'\tEOF\n'> <'\tgit diff --ignore-blank-lines >out.tmp &&\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tdiff --git a/x b/x\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -1,5 +1,7 @@\n'> <'\t+change\n'> <'\t 1\n'> <'\t 2\n'> <'\t+\n'> <'\t 3\n'> <'\t 4\n'> <'\t 5\n'> <'\t@@ -8,5 +8,7 @@\n'> <'\t 6\n'> <'\t 7\n'> <'\t 8\n'> <'\t+\n'> <'\t 9\n'> <'\t 10\n'> <'\t+change\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected out.tmp\n'> ) } ) (C {(test_expect_success)} {(SQ <'ignore-blank-lines: between changes (with interhunkctx)'>)} { (SQ <'\n'> <'\ttest_seq 10 >x &&\n'> <'\tgit update-index x &&\n'> <'\tcat <<-\\EOF >x &&\n'> <'\tchange\n'> <'\t1\n'> <'\t2\n'> <'\n'> <'\t3\n'> <'\t4\n'> <'\t5\n'> <'\n'> <'\t6\n'> <'\t7\n'> <'\t8\n'> <'\t9\n'> <'\n'> <'\t10\n'> <'\tchange\n'> <'\tEOF\n'> <'\tgit diff --inter-hunk-context=2 --ignore-blank-lines >out.tmp &&\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tdiff --git a/x b/x\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -1,10 +1,15 @@\n'> <'\t+change\n'> <'\t 1\n'> <'\t 2\n'> <'\t+\n'> <'\t 3\n'> <'\t 4\n'> <'\t 5\n'> <'\t+\n'> <'\t 6\n'> <'\t 7\n'> <'\t 8\n'> <'\t 9\n'> <'\t+\n'> <'\t 10\n'> <'\t+change\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected out.tmp\n'> ) } ) (C {(test_expect_success)} {(SQ <'ignore-blank-lines: scattered spaces'>)} { (SQ <'\n'> <'\ttest_seq 10 >x &&\n'> <'\tgit update-index x &&\n'> <'\tcat <<-\\EOF >x &&\n'> <'\tchange\n'> <'\t1\n'> <'\t2\n'> <'\t3\n'> <'\n'> <'\t4\n'> <'\n'> <'\t5\n'> <'\n'> <'\t6\n'> <'\n'> <'\n'> <'\t7\n'> <'\n'> <'\t8\n'> <'\t9\n'> <'\t10\n'> <'\tchange\n'> <'\tEOF\n'> <'\tgit diff --inter-hunk-context=4 --ignore-blank-lines >out.tmp &&\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tdiff --git a/x b/x\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -1,3 +1,4 @@\n'> <'\t+change\n'> <'\t 1\n'> <'\t 2\n'> <'\t 3\n'> <'\t@@ -8,3 +15,4 @@\n'> <'\t 8\n'> <'\t 9\n'> <'\t 10\n'> <'\t+change\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected out.tmp\n'> ) } ) (C {(test_expect_success)} {(SQ <'ignore-blank-lines: spaces coalesce'>)} { (SQ <'\n'> <'\ttest_seq 6 >x &&\n'> <'\tgit update-index x &&\n'> <'\tcat <<-\\EOF >x &&\n'> <'\tchange\n'> <'\t1\n'> <'\t2\n'> <'\t3\n'> <'\n'> <'\t4\n'> <'\n'> <'\t5\n'> <'\n'> <'\t6\n'> <'\tchange\n'> <'\tEOF\n'> <'\tgit diff --inter-hunk-context=4 --ignore-blank-lines >out.tmp &&\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tdiff --git a/x b/x\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -1,6 +1,11 @@\n'> <'\t+change\n'> <'\t 1\n'> <'\t 2\n'> <'\t 3\n'> <'\t+\n'> <'\t 4\n'> <'\t+\n'> <'\t 5\n'> <'\t+\n'> <'\t 6\n'> <'\t+change\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected out.tmp\n'> ) } ) (C {(test_expect_success)} {(SQ <'ignore-blank-lines: mix changes and blank lines'>)} { (SQ <'\n'> <'\ttest_seq 16 >x &&\n'> <'\tgit update-index x &&\n'> <'\tcat <<-\\EOF >x &&\n'> <'\tchange\n'> <'\t1\n'> <'\t2\n'> <'\n'> <'\t3\n'> <'\t4\n'> <'\t5\n'> <'\tchange\n'> <'\t6\n'> <'\t7\n'> <'\t8\n'> <'\n'> <'\t9\n'> <'\t10\n'> <'\t11\n'> <'\tchange\n'> <'\t12\n'> <'\t13\n'> <'\t14\n'> <'\n'> <'\t15\n'> <'\t16\n'> <'\tchange\n'> <'\tEOF\n'> <'\tgit diff --ignore-blank-lines >out.tmp &&\n'> <'\tcat <<-\\EOF >expected &&\n'> <'\tdiff --git a/x b/x\n'> <'\t--- a/x\n'> <'\t+++ b/x\n'> <'\t@@ -1,8 +1,11 @@\n'> <'\t+change\n'> <'\t 1\n'> <'\t 2\n'> <'\t+\n'> <'\t 3\n'> <'\t 4\n'> <'\t 5\n'> <'\t+change\n'> <'\t 6\n'> <'\t 7\n'> <'\t 8\n'> <'\t@@ -9,8 +13,11 @@\n'> <'\t 9\n'> <'\t 10\n'> <'\t 11\n'> <'\t+change\n'> <'\t 12\n'> <'\t 13\n'> <'\t 14\n'> <'\t+\n'> <'\t 15\n'> <'\t 16\n'> <'\t+change\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected out.tmp\n'> ) } ) (C {(test_expect_success)} {(SQ <'check mixed spaces and tabs in indent'>)} { (SQ <'\n'> <'\t# This is indented with SP HT SP.\n'> <'\techo " \t foo();" >x &&\n'> <'\tgit diff --check | grep "space before tab in indent"\n'> ) } ) (C {(test_expect_success)} {(SQ <'check mixed tabs and spaces in indent'>)} { (SQ <'\n'> <'\t# This is indented with HT SP HT.\n'> <'\techo "\t \tfoo();" >x &&\n'> <'\tgit diff --check | grep "space before tab in indent"\n'> ) } ) (C {(test_expect_success)} {(SQ <'check with no whitespace errors'>)} { (SQ <'\n'> <'\tgit commit -m "snapshot" &&\n'> <'\techo "foo();" >x &&\n'> <'\tgit diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check with trailing whitespace'>)} {(SQ <'\n'> <'\techo "foo(); " >x &&\n'> <'\ttest_must_fail git diff --check\n'>)} ) (C {(test_expect_success)} {(SQ <'check with space before tab in indent'>)} { (SQ <'\n'> <'\t# indent has space followed by hard tab\n'> <'\techo " \tfoo();" >x &&\n'> <'\ttest_must_fail git diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'--check and --exit-code are not exclusive'>)} {(SQ <'\n'> <'\tgit checkout x &&\n'> <'\tgit diff --check --exit-code\n'>)} ) (C {(test_expect_success)} {(SQ <'--check and --quiet are not exclusive'>)} {(SQ <'\n'> <'\tgit diff --check --quiet\n'>)} ) (C {(test_expect_success)} {(SQ <'check staged with no whitespace errors'>)} { (SQ <'\n'> <'\techo "foo();" >x &&\n'> <'\tgit add x &&\n'> <'\tgit diff --cached --check\n'>) } ) (C {(test_expect_success)} {(SQ <'check staged with trailing whitespace'>)} { (SQ <'\n'> <'\techo "foo(); " >x &&\n'> <'\tgit add x &&\n'> <'\ttest_must_fail git diff --cached --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check staged with space before tab in indent'>)} { (SQ <'\n'> <'\t# indent has space followed by hard tab\n'> <'\techo " \tfoo();" >x &&\n'> <'\tgit add x &&\n'> <'\ttest_must_fail git diff --cached --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check with no whitespace errors (diff-index)'>)} { (SQ <'\n'> <'\techo "foo();" >x &&\n'> <'\tgit add x &&\n'> <'\tgit diff-index --check HEAD\n'>) } ) (C {(test_expect_success)} {(SQ <'check with trailing whitespace (diff-index)'>)} { (SQ <'\n'> <'\techo "foo(); " >x &&\n'> <'\tgit add x &&\n'> <'\ttest_must_fail git diff-index --check HEAD\n'> ) } ) (C {(test_expect_success)} {(SQ <'check with space before tab in indent (diff-index)'>)} { (SQ <'\n'> <'\t# indent has space followed by hard tab\n'> <'\techo " \tfoo();" >x &&\n'> <'\tgit add x &&\n'> <'\ttest_must_fail git diff-index --check HEAD\n'> ) } ) (C {(test_expect_success)} {(SQ <'check staged with no whitespace errors (diff-index)'>)} { (SQ <'\n'> <'\techo "foo();" >x &&\n'> <'\tgit add x &&\n'> <'\tgit diff-index --cached --check HEAD\n'> ) } ) (C {(test_expect_success)} {(SQ <'check staged with trailing whitespace (diff-index)'>)} { (SQ <'\n'> <'\techo "foo(); " >x &&\n'> <'\tgit add x &&\n'> <'\ttest_must_fail git diff-index --cached --check HEAD\n'> ) } ) (C {(test_expect_success)} {(SQ <'check staged with space before tab in indent (diff-index)'>)} { (SQ <'\n'> <'\t# indent has space followed by hard tab\n'> <'\techo " \tfoo();" >x &&\n'> <'\tgit add x &&\n'> <'\ttest_must_fail git diff-index --cached --check HEAD\n'> ) } ) (C {(test_expect_success)} {(SQ <'check with no whitespace errors (diff-tree)'>)} { (SQ <'\n'> <'\techo "foo();" >x &&\n'> <'\tgit commit -m "new commit" x &&\n'> <'\tgit diff-tree --check HEAD^ HEAD\n'> ) } ) (C {(test_expect_success)} {(SQ <'check with trailing whitespace (diff-tree)'>)} { (SQ <'\n'> <'\techo "foo(); " >x &&\n'> <'\tgit commit -m "another commit" x &&\n'> <'\ttest_must_fail git diff-tree --check HEAD^ HEAD\n'> ) } ) (C {(test_expect_success)} {(SQ <'check with space before tab in indent (diff-tree)'>)} { (SQ <'\n'> <'\t# indent has space followed by hard tab\n'> <'\techo " \tfoo();" >x &&\n'> <'\tgit commit -m "yet another" x &&\n'> <'\ttest_must_fail git diff-tree --check HEAD^ HEAD\n'> ) } ) (C {(test_expect_success)} {(SQ <'check trailing whitespace (trailing-space: off)'>)} { (SQ <'\n'> <'\tgit config core.whitespace "-trailing-space" &&\n'> <'\techo "foo (); " >x &&\n'> <'\tgit diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check trailing whitespace (trailing-space: on)'>)} { (SQ <'\n'> <'\tgit config core.whitespace "trailing-space" &&\n'> <'\techo "foo (); " >x &&\n'> <'\ttest_must_fail git diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check space before tab in indent (space-before-tab: off)'>)} { (SQ <'\n'> <'\t# indent contains space followed by HT\n'> <'\tgit config core.whitespace "-space-before-tab" &&\n'> <'\techo " \tfoo ();" >x &&\n'> <'\tgit diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check space before tab in indent (space-before-tab: on)'>)} { (SQ <'\n'> <'\t# indent contains space followed by HT\n'> <'\tgit config core.whitespace "space-before-tab" &&\n'> <'\techo " \tfoo (); " >x &&\n'> <'\ttest_must_fail git diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check spaces as indentation (indent-with-non-tab: off)'>)} { (SQ <'\n'> <'\tgit config core.whitespace "-indent-with-non-tab" &&\n'> <'\techo " foo ();" >x &&\n'> <'\tgit diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check spaces as indentation (indent-with-non-tab: on)'>)} { (SQ <'\n'> <'\tgit config core.whitespace "indent-with-non-tab" &&\n'> <'\techo " foo ();" >x &&\n'> <'\ttest_must_fail git diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'ditto, but tabwidth=9'>)} { (SQ <'\n'> <'\tgit config core.whitespace "indent-with-non-tab,tabwidth=9" &&\n'> <'\tgit diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check tabs and spaces as indentation (indent-with-non-tab: on)'>)} { (SQ <'\n'> <'\tgit config core.whitespace "indent-with-non-tab" &&\n'> <'\techo "\t foo ();" >x &&\n'> <'\ttest_must_fail git diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'ditto, but tabwidth=10'>)} { (SQ <'\n'> <'\tgit config core.whitespace "indent-with-non-tab,tabwidth=10" &&\n'> <'\ttest_must_fail git diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'ditto, but tabwidth=20'>)} { (SQ <'\n'> <'\tgit config core.whitespace "indent-with-non-tab,tabwidth=20" &&\n'> <'\tgit diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check tabs as indentation (tab-in-indent: off)'>)} { (SQ <'\n'> <'\tgit config core.whitespace "-tab-in-indent" &&\n'> <'\techo "\tfoo ();" >x &&\n'> <'\tgit diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check tabs as indentation (tab-in-indent: on)'>)} { (SQ <'\n'> <'\tgit config core.whitespace "tab-in-indent" &&\n'> <'\techo "\tfoo ();" >x &&\n'> <'\ttest_must_fail git diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check tabs and spaces as indentation (tab-in-indent: on)'>)} { (SQ <'\n'> <'\tgit config core.whitespace "tab-in-indent" &&\n'> <'\techo "\t foo ();" >x &&\n'> <'\ttest_must_fail git diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'ditto, but tabwidth=1 (must be irrelevant)'>)} { (SQ <'\n'> <'\tgit config core.whitespace "tab-in-indent,tabwidth=1" &&\n'> <'\ttest_must_fail git diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check tab-in-indent and indent-with-non-tab conflict'>)} { (SQ <'\n'> <'\tgit config core.whitespace "tab-in-indent,indent-with-non-tab" &&\n'> <'\techo "foo ();" >x &&\n'> <'\ttest_must_fail git diff --check\n'> ) } ) (C {(test_expect_success)} {(SQ <'check tab-in-indent excluded from wildcard whitespace attribute'>)} { (SQ <'\n'> <'\tgit config --unset core.whitespace &&\n'> <'\techo "x whitespace" >.gitattributes &&\n'> <'\techo "\t foo ();" >x &&\n'> <'\tgit diff --check &&\n'> <'\trm -f .gitattributes\n'> ) } ) (C {(test_expect_success)} {(SQ <'line numbers in --check output are correct'>)} { (SQ <'\n'> <'\techo "" >x &&\n'> <'\techo "foo(); " >>x &&\n'> <'\tgit diff --check | grep "x:2:"\n'> ) } ) (C {(test_expect_success)} {(SQ <'checkdiff detects new trailing blank lines (1)'>)} { (SQ <'\n'> <'\techo "foo();" >x &&\n'> <'\techo "" >>x &&\n'> <'\tgit diff --check | grep "new blank line"\n'> ) } ) (C {(test_expect_success)} {(SQ <'checkdiff detects new trailing blank lines (2)'>)} { (SQ <'\n'> <'\t{ echo a; echo b; echo; echo; } >x &&\n'> <'\tgit add x &&\n'> <'\t{ echo a; echo; echo; echo; echo; } >x &&\n'> <'\tgit diff --check | grep "new blank line"\n'> ) } ) (C {(test_expect_success)} {(SQ <'checkdiff allows new blank lines'>)} { (SQ <'\n'> <'\tgit checkout x &&\n'> <'\tmv x y &&\n'> <'\t(\n'> <'\t\techo "/* This is new */" &&\n'> <'\t\techo "" &&\n'> <'\t\tcat y\n'> <'\t) >x &&\n'> <'\tgit diff --check\n'> ) } ) (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: 16777215 body: {(DQ )} do_expansion: True here_end: EOF was_filled: T spids: [1158] ) (Redir op_id:Redir_Great fd:16777215 arg_word:{(expect)} spids:[1161]) ] ) (C {(test_expect_success)} {(SQ <'whitespace-only changes not reported'>)} { (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\techo >x "hello world" &&\n'> <'\tgit add x &&\n'> <'\tgit commit -m "hello 1" &&\n'> <'\techo >x "hello world" &&\n'> <'\tgit diff -b >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: 16777215 body: { (DQ ('diff --git a/x b/z\n') ('similarity index NUM%\n') ('rename from x\n') ('rename to z\n') ('index 380c32a..a97b785 100644\n') ) } do_expansion: True here_end: EOF was_filled: T spids: [1185] ) (Redir op_id:Redir_Great fd:16777215 arg_word:{(expect)} spids:[1188]) ] ) (C {(test_expect_success)} {(SQ <'whitespace-only changes reported across renames'>)} { (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\tfor i in 1 2 3 4 5 6 7 8 9; do echo "$i$i$i$i$i$i"; done >x &&\n'> <'\tgit add x &&\n'> <'\tgit commit -m "base" &&\n'> <'\tsed -e "5s/^/ /" x >z &&\n'> <'\tgit rm x &&\n'> <'\tgit add z &&\n'> <'\tgit diff -w -M --cached |\n'> <'\tsed -e "/^similarity index /s/[0-9][0-9]*/NUM/" >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[1220]) (HereDoc op_id: Redir_DLess fd: 16777215 body: {('diff --git a/empty b/void\n') ('similarity index 100%\n') ('rename from empty\n') ('rename to void\n') } do_expansion: False here_end: EOF was_filled: T spids: [1223] ) ] ) (C {(test_expect_success)} {(SQ <'rename empty'>)} { (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\t>empty &&\n'> <'\tgit add empty &&\n'> <'\tgit commit -m empty &&\n'> <'\tgit mv empty void &&\n'> <'\tgit diff -w --cached -M >current &&\n'> <'\ttest_cmp expected current\n'> ) } ) (C {(test_expect_success)} {(SQ <'combined diff with autocrlf conversion'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\techo >x hello &&\n'> <'\tgit commit -m "one side" x &&\n'> <'\tgit checkout HEAD^ &&\n'> <'\techo >x goodbye &&\n'> <'\tgit commit -m "the other side" x &&\n'> <'\tgit config core.autocrlf true &&\n'> <'\ttest_must_fail git merge master &&\n'> <'\n'> <'\tgit diff | sed -e "1,/^@@@/d" >actual &&\n'> <'\t! grep "^-" actual\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'setup diff colors'>)} { (SQ <'\n'> <'\tgit config color.diff always &&\n'> <'\tgit config color.diff.plain normal &&\n'> <'\tgit config color.diff.meta bold &&\n'> <'\tgit config color.diff.frag cyan &&\n'> <'\tgit config color.diff.func normal &&\n'> <'\tgit config color.diff.old red &&\n'> <'\tgit config color.diff.new green &&\n'> <'\tgit config color.diff.commit yellow &&\n'> <'\tgit config color.diff.whitespace blue &&\n'> <'\n'> <'\tgit config core.autocrlf false\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff that introduces a line with only tabs'>)} { (SQ <'\n'> <'\tgit config core.whitespace blank-at-eol &&\n'> <'\tgit reset --hard &&\n'> <'\techo "test" >x &&\n'> <'\tgit commit -m "initial" x &&\n'> <'\techo "{NTN}" | tr "NT" "\\n\\t" >>x &&\n'> <'\tgit -c color.diff=always diff | test_decode_color >current &&\n'> <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\t<BOLD>diff --git a/x b/x<RESET>\n'> <'\t<BOLD>index 9daeafb..2874b91 100644<RESET>\n'> <'\t<BOLD>--- a/x<RESET>\n'> <'\t<BOLD>+++ b/x<RESET>\n'> <'\t<CYAN>@@ -1 +1,4 @@<RESET>\n'> <'\t test<RESET>\n'> <'\t<GREEN>+<RESET><GREEN>{<RESET>\n'> <'\t<GREEN>+<RESET><BLUE>\t<RESET>\n'> <'\t<GREEN>+<RESET><GREEN>}<RESET>\n'> <'\tEOF\n'> <'\n'> <'\ttest_cmp expected current\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff that introduces and removes ws breakages'>)} { (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\t{\n'> <'\t\techo "0. blank-at-eol " &&\n'> <'\t\techo "1. blank-at-eol "\n'> <'\t} >x &&\n'> <'\tgit commit -a --allow-empty -m preimage &&\n'> <'\t{\n'> <'\t\techo "0. blank-at-eol " &&\n'> <'\t\techo "1. still-blank-at-eol " &&\n'> <'\t\techo "2. and a new line "\n'> <'\t} >x &&\n'> <'\n'> <'\tgit -c color.diff=always diff |\n'> <'\ttest_decode_color >current &&\n'> <'\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\t<BOLD>diff --git a/x b/x<RESET>\n'> <'\t<BOLD>index d0233a2..700886e 100644<RESET>\n'> <'\t<BOLD>--- a/x<RESET>\n'> <'\t<BOLD>+++ b/x<RESET>\n'> <'\t<CYAN>@@ -1,2 +1,3 @@<RESET>\n'> <'\t 0. blank-at-eol <RESET>\n'> <'\t<RED>-1. blank-at-eol <RESET>\n'> <'\t<GREEN>+<RESET><GREEN>1. still-blank-at-eol<RESET><BLUE> <RESET>\n'> <'\t<GREEN>+<RESET><GREEN>2. and a new line<RESET><BLUE> <RESET>\n'> <'\tEOF\n'> <'\n'> <'\ttest_cmp expected current\n'> ) } ) (C {(test_expect_success)} {(SQ <'ws-error-highlight test setup'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\t{\n'> <'\t\techo "0. blank-at-eol " &&\n'> <'\t\techo "1. blank-at-eol "\n'> <'\t} >x &&\n'> <'\tgit commit -a --allow-empty -m preimage &&\n'> <'\t{\n'> <'\t\techo "0. blank-at-eol " &&\n'> <'\t\techo "1. still-blank-at-eol " &&\n'> <'\t\techo "2. and a new line "\n'> <'\t} >x &&\n'> <'\n'> <'\tcat >expect.default-old <<-\\EOF &&\n'> <'\t<BOLD>diff --git a/x b/x<RESET>\n'> <'\t<BOLD>index d0233a2..700886e 100644<RESET>\n'> <'\t<BOLD>--- a/x<RESET>\n'> <'\t<BOLD>+++ b/x<RESET>\n'> <'\t<CYAN>@@ -1,2 +1,3 @@<RESET>\n'> <'\t 0. blank-at-eol <RESET>\n'> <'\t<RED>-<RESET><RED>1. blank-at-eol<RESET><BLUE> <RESET>\n'> <'\t<GREEN>+<RESET><GREEN>1. still-blank-at-eol<RESET><BLUE> <RESET>\n'> <'\t<GREEN>+<RESET><GREEN>2. and a new line<RESET><BLUE> <RESET>\n'> <'\tEOF\n'> <'\n'> <'\tcat >expect.all <<-\\EOF &&\n'> <'\t<BOLD>diff --git a/x b/x<RESET>\n'> <'\t<BOLD>index d0233a2..700886e 100644<RESET>\n'> <'\t<BOLD>--- a/x<RESET>\n'> <'\t<BOLD>+++ b/x<RESET>\n'> <'\t<CYAN>@@ -1,2 +1,3 @@<RESET>\n'> <'\t <RESET>0. blank-at-eol<RESET><BLUE> <RESET>\n'> <'\t<RED>-<RESET><RED>1. blank-at-eol<RESET><BLUE> <RESET>\n'> <'\t<GREEN>+<RESET><GREEN>1. still-blank-at-eol<RESET><BLUE> <RESET>\n'> <'\t<GREEN>+<RESET><GREEN>2. and a new line<RESET><BLUE> <RESET>\n'> <'\tEOF\n'> <'\n'> <'\tcat >expect.none <<-\\EOF\n'> <'\t<BOLD>diff --git a/x b/x<RESET>\n'> <'\t<BOLD>index d0233a2..700886e 100644<RESET>\n'> <'\t<BOLD>--- a/x<RESET>\n'> <'\t<BOLD>+++ b/x<RESET>\n'> <'\t<CYAN>@@ -1,2 +1,3 @@<RESET>\n'> <'\t 0. blank-at-eol <RESET>\n'> <'\t<RED>-1. blank-at-eol <RESET>\n'> <'\t<GREEN>+1. still-blank-at-eol <RESET>\n'> <'\t<GREEN>+2. and a new line <RESET>\n'> <'\tEOF\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'test --ws-error-highlight option'>)} { (SQ <'\n'> <'\n'> <'\tgit -c color.diff=always diff --ws-error-highlight=default,old |\n'> <'\ttest_decode_color >current &&\n'> <'\ttest_cmp expect.default-old current &&\n'> <'\n'> <'\tgit -c color.diff=always diff --ws-error-highlight=all |\n'> <'\ttest_decode_color >current &&\n'> <'\ttest_cmp expect.all current &&\n'> <'\n'> <'\tgit -c color.diff=always diff --ws-error-highlight=none |\n'> <'\ttest_decode_color >current &&\n'> <'\ttest_cmp expect.none current\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'test diff.wsErrorHighlight config'>)} { (SQ <'\n'> <'\n'> <'\tgit -c color.diff=always -c diff.wsErrorHighlight=default,old diff |\n'> <'\ttest_decode_color >current &&\n'> <'\ttest_cmp expect.default-old current &&\n'> <'\n'> <'\tgit -c color.diff=always -c diff.wsErrorHighlight=all diff |\n'> <'\ttest_decode_color >current &&\n'> <'\ttest_cmp expect.all current &&\n'> <'\n'> <'\tgit -c color.diff=always -c diff.wsErrorHighlight=none diff |\n'> <'\ttest_decode_color >current &&\n'> <'\ttest_cmp expect.none current\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'option overrides diff.wsErrorHighlight'>)} { (SQ <'\n'> <'\n'> <'\tgit -c color.diff=always -c diff.wsErrorHighlight=none \\\n'> <'\t\tdiff --ws-error-highlight=default,old |\n'> <'\ttest_decode_color >current &&\n'> <'\ttest_cmp expect.default-old current &&\n'> <'\n'> <'\tgit -c color.diff=always -c diff.wsErrorHighlight=default \\\n'> <'\t\tdiff --ws-error-highlight=all |\n'> <'\ttest_decode_color >current &&\n'> <'\ttest_cmp expect.all current &&\n'> <'\n'> <'\tgit -c color.diff=always -c diff.wsErrorHighlight=all \\\n'> <'\t\tdiff --ws-error-highlight=none |\n'> <'\ttest_decode_color >current &&\n'> <'\ttest_cmp expect.none current\n'> <'\n'> ) } ) (C {(test_done)}) ] )