(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"word diff colors">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_Name "$TEST_DIRECTORY")) (/diff-lib.sh)}) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(pre.simple)} spids:[24]) (HereDoc op_id: Redir_DLessDash fd: -1 body: {("h(4)\n") ("\n") ("a = b + c\n")} do_expansion: False here_end: EOF was_filled: True spids: [27] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(post.simple)} spids:[33]) (HereDoc op_id: Redir_DLessDash fd: -1 body: {("h(4),hh[44]\n") ("\n") ("a = b + c\n") ("\n") ("aa = a\n") ("\n") ("aeff = aeff * ( aaa )\n") } do_expansion: False here_end: EOF was_filled: True spids: [36] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect.letter-runs-are-words)} spids:[42]) (HereDoc op_id: Redir_DLessDash fd: -1 body: {("<BOLD>diff --git a/pre b/post<RESET>\n") ("<BOLD>index 330b04f..5ed8eff 100644<RESET>\n") ("<BOLD>--- a/pre<RESET>\n") ("<BOLD>+++ b/post<RESET>\n") ("<CYAN>@@ -1,3 +1,7 @@<RESET>\n") ("h(4),<GREEN>hh<RESET>[44]\n") ("\n") ("a = b + c<RESET>\n") ("\n") ("<GREEN>aa = a<RESET>\n") ("\n") ("<GREEN>aeff = aeff * ( aaa<RESET> )\n") } do_expansion: False here_end: EOF was_filled: True spids: [45] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect.non-whitespace-is-word)} spids:[51]) (HereDoc op_id: Redir_DLessDash fd: -1 body: {("<BOLD>diff --git a/pre b/post<RESET>\n") ("<BOLD>index 330b04f..5ed8eff 100644<RESET>\n") ("<BOLD>--- a/pre<RESET>\n") ("<BOLD>+++ b/post<RESET>\n") ("<CYAN>@@ -1,3 +1,7 @@<RESET>\n") ("h(4)<GREEN>,hh[44]<RESET>\n") ("\n") ("a = b + c<RESET>\n") ("\n") ("<GREEN>aa = a<RESET>\n") ("\n") ("<GREEN>aeff = aeff * ( aaa )<RESET>\n") } do_expansion: False here_end: EOF was_filled: True spids: [54] ) ] ) (FuncDef name: word_diff body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [ {(test_must_fail)} {(git)} {(diff)} {(--no-index)} {(DQ ($ VSub_At "$@"))} {(pre)} {(post)} ] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(output)} spids:[83])] ) (AndOr children: [ (SimpleCommand words: [{(test_decode_color)}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(output)} spids: [91] ) (Redir op_id: Redir_Great fd: -1 arg_word: {(output.decrypted)} spids: [94] ) ] ) (C {(test_cmp)} {(expect)} {(output.decrypted)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [64] ) spids: [59 63] ) (FuncDef name: test_language_driver body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:lang) op: Equal rhs: {($ VSub_Number "$1")} spids: [117] ) ] spids: [117] ) (C {(test_expect_success)} {(DQ ("diff driver '") ($ VSub_Name "$lang") ("'"))} {(SQ <"\n"> <"\t\tcp \"$TEST_DIRECTORY/t4034/">) (DQ ($ VSub_Name "$lang")) (SQ <"/pre\" \\\n"> <"\t\t\t\"$TEST_DIRECTORY/t4034/">) (DQ ($ VSub_Name "$lang")) (SQ <"/post\" \\\n"> <"\t\t\t\"$TEST_DIRECTORY/t4034/">) (DQ ($ VSub_Name "$lang")) (SQ <"/expect\" . &&\n"> <"\t\techo \"* diff=">) (DQ ($ VSub_Name "$lang")) (SQ <"\" >.gitattributes &&\n"> <"\t\tword_diff --color-words\n"> <"\t">) } ) ] spids: [114] ) spids: [109 113] ) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\tgit config diff.color.old red &&\n"> <"\tgit config diff.color.new green &&\n"> <"\tgit config diff.color.func magenta\n"> ) } ) (C {(test_expect_success)} {(SQ <"set up pre and post with runs of whitespace">)} {(SQ <"\n"> <"\tcp pre.simple pre &&\n"> <"\tcp post.simple post\n">)} ) (C {(test_expect_success)} {(SQ <"word diff with runs of whitespace">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t\t<BOLD>diff --git a/pre b/post<RESET>\n"> <"\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n"> <"\t\t<BOLD>--- a/pre<RESET>\n"> <"\t\t<BOLD>+++ b/post<RESET>\n"> <"\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n"> <"\t\t<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>\n"> <"\n"> <"\t\ta = b + c<RESET>\n"> <"\n"> <"\t\t<GREEN>aa = a<RESET>\n"> <"\n"> <"\t\t<GREEN>aeff = aeff * ( aaa )<RESET>\n"> <"\tEOF\n"> <"\tword_diff --color-words &&\n"> <"\tword_diff --word-diff=color &&\n"> <"\tword_diff --color --word-diff=color\n"> ) } ) (C {(test_expect_success)} {(SQ <"--word-diff=porcelain">)} {(SQ <"\n"> <"\tsed ">) (s/) (Lit_Pound "#") (.) (Lit_Other "*") (Lit_Other "$") (//) (SQ <" >expect <<-\\EOF &&\n"> <"\t\tdiff --git a/pre b/post\n"> <"\t\tindex 330b04f..5ed8eff 100644\n"> <"\t\t--- a/pre\n"> <"\t\t+++ b/post\n"> <"\t\t@@ -1,3 +1,7 @@\n"> <"\t\t-h(4)\n"> <"\t\t+h(4),hh[44]\n"> <"\t\t~\n"> <"\t\t # significant space\n"> <"\t\t~\n"> <"\t\t a = b + c\n"> <"\t\t~\n"> <"\t\t~\n"> <"\t\t+aa = a\n"> <"\t\t~\n"> <"\t\t~\n"> <"\t\t+aeff = aeff * ( aaa )\n"> <"\t\t~\n"> <"\tEOF\n"> <"\tword_diff --word-diff=porcelain\n"> ) } ) (C {(test_expect_success)} {(SQ <"--word-diff=plain">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t\tdiff --git a/pre b/post\n"> <"\t\tindex 330b04f..5ed8eff 100644\n"> <"\t\t--- a/pre\n"> <"\t\t+++ b/post\n"> <"\t\t@@ -1,3 +1,7 @@\n"> <"\t\t[-h(4)-]{+h(4),hh[44]+}\n"> <"\n"> <"\t\ta = b + c\n"> <"\n"> <"\t\t{+aa = a+}\n"> <"\n"> <"\t\t{+aeff = aeff * ( aaa )+}\n"> <"\tEOF\n"> <"\tword_diff --word-diff=plain &&\n"> <"\tword_diff --word-diff=plain --no-color\n"> ) } ) (C {(test_expect_success)} {(SQ <"--word-diff=plain --color">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t\t<BOLD>diff --git a/pre b/post<RESET>\n"> <"\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n"> <"\t\t<BOLD>--- a/pre<RESET>\n"> <"\t\t<BOLD>+++ b/post<RESET>\n"> <"\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n"> <"\t\t<RED>[-h(4)-]<RESET><GREEN>{+h(4),hh[44]+}<RESET>\n"> <"\n"> <"\t\ta = b + c<RESET>\n"> <"\n"> <"\t\t<GREEN>{+aa = a+}<RESET>\n"> <"\n"> <"\t\t<GREEN>{+aeff = aeff * ( aaa )+}<RESET>\n"> <"\tEOF\n"> <"\tword_diff --word-diff=plain --color\n"> ) } ) (C {(test_expect_success)} {(SQ <"word diff without context">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t\t<BOLD>diff --git a/pre b/post<RESET>\n"> <"\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n"> <"\t\t<BOLD>--- a/pre<RESET>\n"> <"\t\t<BOLD>+++ b/post<RESET>\n"> <"\t\t<CYAN>@@ -1 +1 @@<RESET>\n"> <"\t\t<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>\n"> <"\t\t<CYAN>@@ -3,0 +4,4 @@<RESET> <RESET><MAGENTA>a = b + c<RESET>\n"> <"\n"> <"\t\t<GREEN>aa = a<RESET>\n"> <"\n"> <"\t\t<GREEN>aeff = aeff * ( aaa )<RESET>\n"> <"\tEOF\n"> <"\tword_diff --color-words --unified=0\n"> ) } ) (C {(test_expect_success)} {(SQ <"word diff with a regular expression">)} { (SQ <"\n"> <"\tcp expect.letter-runs-are-words expect &&\n"> <"\tword_diff --color-words=\"[a-z]+\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"set up a diff driver">)} { (SQ <"\n"> <"\tgit config diff.testdriver.wordRegex \"[^[:space:]]\" &&\n"> <"\tcat <<-\\EOF >.gitattributes\n"> <"\t\tpre diff=testdriver\n"> <"\t\tpost diff=testdriver\n"> <"\tEOF\n"> ) } ) (C {(test_expect_success)} {(SQ <"option overrides .gitattributes">)} { (SQ <"\n"> <"\tcp expect.letter-runs-are-words expect &&\n"> <"\tword_diff --color-words=\"[a-z]+\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"use regex supplied by driver">)} { (SQ <"\n"> <"\tcp expect.non-whitespace-is-word expect &&\n"> <"\tword_diff --color-words\n">) } ) (C {(test_expect_success)} {(SQ <"set up diff.wordRegex option">)} {(SQ <"\n"> <"\tgit config diff.wordRegex \"[[:alnum:]]+\"\n">)} ) (C {(test_expect_success)} {(SQ <"command-line overrides config">)} { (SQ <"\n"> <"\tcp expect.letter-runs-are-words expect &&\n"> <"\tword_diff --color-words=\"[a-z]+\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"command-line overrides config: --word-diff-regex">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t\t<BOLD>diff --git a/pre b/post<RESET>\n"> <"\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n"> <"\t\t<BOLD>--- a/pre<RESET>\n"> <"\t\t<BOLD>+++ b/post<RESET>\n"> <"\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n"> <"\t\th(4),<GREEN>{+hh+}<RESET>[44]\n"> <"\n"> <"\t\ta = b + c<RESET>\n"> <"\n"> <"\t\t<GREEN>{+aa = a+}<RESET>\n"> <"\n"> <"\t\t<GREEN>{+aeff = aeff * ( aaa+}<RESET> )\n"> <"\tEOF\n"> <"\tword_diff --color --word-diff-regex=\"[a-z]+\"\n"> ) } ) (C {(test_expect_success)} {(SQ <".gitattributes override config">)} { (SQ <"\n"> <"\tcp expect.non-whitespace-is-word expect &&\n"> <"\tword_diff --color-words\n">) } ) (C {(test_expect_success)} {(SQ <"setup: remove diff driver regex">)} {(SQ <"\n"> <"\ttest_unconfig diff.testdriver.wordRegex\n">)} ) (C {(test_expect_success)} {(SQ <"use configured regex">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t\t<BOLD>diff --git a/pre b/post<RESET>\n"> <"\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n"> <"\t\t<BOLD>--- a/pre<RESET>\n"> <"\t\t<BOLD>+++ b/post<RESET>\n"> <"\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n"> <"\t\th(4),<GREEN>hh[44<RESET>]\n"> <"\n"> <"\t\ta = b + c<RESET>\n"> <"\n"> <"\t\t<GREEN>aa = a<RESET>\n"> <"\n"> <"\t\t<GREEN>aeff = aeff * ( aaa<RESET> )\n"> <"\tEOF\n"> <"\tword_diff --color-words\n"> ) } ) (C {(test_expect_success)} {(SQ <"test parsing words for newline">)} { (SQ <"\n"> <"\techo \"aaa (aaa)\" >pre &&\n"> <"\techo \"aaa (aaa) aaa\" >post &&\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t\t<BOLD>diff --git a/pre b/post<RESET>\n"> <"\t\t<BOLD>index c29453b..be22f37 100644<RESET>\n"> <"\t\t<BOLD>--- a/pre<RESET>\n"> <"\t\t<BOLD>+++ b/post<RESET>\n"> <"\t\t<CYAN>@@ -1 +1 @@<RESET>\n"> <"\t\taaa (aaa) <GREEN>aaa<RESET>\n"> <"\tEOF\n"> <"\tword_diff --color-words=\"a+\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"test when words are only removed at the end">)} { (SQ <"\n"> <"\techo \"(:\" >pre &&\n"> <"\techo \"(\" >post &&\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t\t<BOLD>diff --git a/pre b/post<RESET>\n"> <"\t\t<BOLD>index 289cb9d..2d06f37 100644<RESET>\n"> <"\t\t<BOLD>--- a/pre<RESET>\n"> <"\t\t<BOLD>+++ b/post<RESET>\n"> <"\t\t<CYAN>@@ -1 +1 @@<RESET>\n"> <"\t\t(<RED>:<RESET>\n"> <"\tEOF\n"> <"\tword_diff --color-words=.\n"> ) } ) (C {(test_expect_success)} {(SQ <"--word-diff=none">)} { (SQ <"\n"> <"\techo \"(:\" >pre &&\n"> <"\techo \"(\" >post &&\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t\tdiff --git a/pre b/post\n"> <"\t\tindex 289cb9d..2d06f37 100644\n"> <"\t\t--- a/pre\n"> <"\t\t+++ b/post\n"> <"\t\t@@ -1 +1 @@\n"> <"\t\t-(:\n"> <"\t\t+(\n"> <"\tEOF\n"> <"\tword_diff --word-diff=plain --word-diff=none\n"> ) } ) (C {(test_expect_success)} {(SQ <"unset default driver">)} {(SQ <"\n"> <"\ttest_unconfig diff.wordregex\n">)} ) (C {(test_language_driver)} {(ada)}) (C {(test_language_driver)} {(bibtex)}) (C {(test_language_driver)} {(cpp)}) (C {(test_language_driver)} {(csharp)}) (C {(test_language_driver)} {(css)}) (C {(test_language_driver)} {(fortran)}) (C {(test_language_driver)} {(html)}) (C {(test_language_driver)} {(java)}) (C {(test_language_driver)} {(matlab)}) (C {(test_language_driver)} {(objc)}) (C {(test_language_driver)} {(pascal)}) (C {(test_language_driver)} {(perl)}) (C {(test_language_driver)} {(php)}) (C {(test_language_driver)} {(python)}) (C {(test_language_driver)} {(ruby)}) (C {(test_language_driver)} {(tex)}) (C {(test_expect_success)} {(SQ <"word-diff with diff.sbe">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\tdiff --git a/pre b/post\n"> <"\tindex a1a53b5..bc8fe6d 100644\n"> <"\t--- a/pre\n"> <"\t+++ b/post\n"> <"\t@@ -1,3 +1,3 @@\n"> <"\ta\n"> <"\n"> <"\t[-b-]{+c+}\n"> <"\tEOF\n"> <"\tcat >pre <<-\\EOF &&\n"> <"\ta\n"> <"\n"> <"\tb\n"> <"\tEOF\n"> <"\tcat >post <<-\\EOF &&\n"> <"\ta\n"> <"\n"> <"\tc\n"> <"\tEOF\n"> <"\ttest_config diff.suppress-blank-empty true &&\n"> <"\tword_diff --word-diff=plain\n"> ) } ) (C {(test_expect_success)} {(SQ <"word-diff with no newline at EOF">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\tdiff --git a/pre b/post\n"> <"\tindex 7bf316e..3dd0303 100644\n"> <"\t--- a/pre\n"> <"\t+++ b/post\n"> <"\t@@ -1 +1 @@\n"> <"\ta a [-a-]{+ab+} a a\n"> <"\tEOF\n"> <"\tprintf \"%s\" \"a a a a a\" >pre &&\n"> <"\tprintf \"%s\" \"a a ab a a\" >post &&\n"> <"\tword_diff --word-diff=plain\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup history with two files">)} { (SQ <"\n"> <"\techo \"a b; c\" >a.tex &&\n"> <"\techo \"a b; c\" >z.txt &&\n"> <"\tgit add a.tex z.txt &&\n"> <"\tgit commit -minitial &&\n"> <"\n"> <"\t# modify both\n"> <"\techo \"a bx; c\" >a.tex &&\n"> <"\techo \"a bx; c\" >z.txt &&\n"> <"\tgit commit -mmodified -a\n"> ) } ) (C {(test_expect_success)} {(SQ <"wordRegex for the first file does not apply to the second">)} { (SQ <"\n"> <"\techo \"*.tex diff=tex\" >.gitattributes &&\n"> <"\ttest_config diff.tex.wordRegex \"[a-z]+|.\" &&\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\t\tdiff --git a/a.tex b/a.tex\n"> <"\t\t--- a/a.tex\n"> <"\t\t+++ b/a.tex\n"> <"\t\t@@ -1 +1 @@\n"> <"\t\ta [-b-]{+bx+}; c\n"> <"\t\tdiff --git a/z.txt b/z.txt\n"> <"\t\t--- a/z.txt\n"> <"\t\t+++ b/z.txt\n"> <"\t\t@@ -1 +1 @@\n"> <"\t\ta [-b;-]{+bx;+} c\n"> <"\tEOF\n"> <"\tgit diff --word-diff HEAD~ >actual &&\n"> <"\tcompare_diff_patch expect actual\n"> ) } ) (C {(test_done)}) ] )