(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'Test diff-highlight'>)} spids: [4] ) ] spids: [4] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CURR_DIR) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [11 13] ) } spids: [10] ) ] spids: [10] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TEST_OUTPUT_DIRECTORY) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [16 18] ) } spids: [15] ) ] spids: [15] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TEST_DIRECTORY) op: Equal rhs: {(DQ ($ VSub_Name '$CURR_DIR')) (/../../../t)} spids: [20] ) ] spids: [20] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DIFF_HIGHLIGHT) op: Equal rhs: {(DQ ($ VSub_Name '$CURR_DIR')) (/../diff-highlight)} spids: [26] ) ] spids: [26] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CW) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(printf)} {(DQ (Lit_Other '\\') ('033[7m'))})] ) left_token: <Left_CommandSub '$('> spids: [35 42] ) ) } spids: [33] ) ] spids: [33] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CR) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(printf)} {(DQ (Lit_Other '\\') ('033[27m'))})] ) left_token: <Left_CommandSub '$('> spids: [50 57] ) ) } spids: [48] ) ] spids: [48] ) (C {(.)} {(DQ ($ VSub_Name '$TEST_DIRECTORY')) (/test-lib.sh)}) (If arms: [ (if_arm cond: [(Pipeline children:[(C {(test_have_prereq)} {(PERL)})] negated:T)] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {(SQ <'skipping diff-highlight tests; perl not available'>)} spids: [83] ) ] spids: [83] ) (C {(test_done)}) ] spids: [16777215 80] ) ] spids: [16777215 91] ) (FuncDef name: dh_test body: (BraceGroup children: [ (AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:a) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [117] ) (assign_pair lhs: (LhsName name:b) op: Equal rhs: {(DQ ($ VSub_Number '$2'))} spids: [122] ) ] spids: [117] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(patch.exp)} spids: [133] ) ] ) (BraceGroup children: [ (AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (SimpleCommand words: [{(cat)} {(DQ ($ VSub_Name '$a'))}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(file)} spids: [149] ) ] ) (C {(git)} {(add)} {(file)}) (C {(git)} {(commit)} {(-m)} {(DQ ('Add a file'))}) (SimpleCommand words: [{(cat)} {(DQ ($ VSub_Name '$b'))}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(file)} spids: [184] ) ] ) (SimpleCommand words: [{(git)} {(diff)} {(file)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(diff.raw)} spids: [196] ) ] ) (C {(git)} {(commit)} {(-a)} {(-m)} {(DQ ('Update a file'))}) (SimpleCommand words: [{(git)} {(show)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(commit.raw)} spids: [221] ) ] ) ] ) ] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(/dev/null)} spids: [227] ) ] spids: [140] ) (Pipeline children: [ (SimpleCommand words: [{(DQ ($ VSub_Name '$DIFF_HIGHLIGHT'))}] redirects: [ (Redir op_id: Redir_Less fd: 16777215 arg_word: {(diff.raw)} spids: [238] ) ] ) (SimpleCommand words: [{(test_strip_patch_header)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(diff.act)} spids: [245] ) ] ) ] negated: F ) (Pipeline children: [ (SimpleCommand words: [{(DQ ($ VSub_Name '$DIFF_HIGHLIGHT'))}] redirects: [ (Redir op_id: Redir_Less fd: 16777215 arg_word: {(commit.raw)} spids: [255] ) ] ) (SimpleCommand words: [{(test_strip_patch_header)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(commit.act)} spids: [262] ) ] ) ] negated: F ) (C {(test_cmp)} {(patch.exp)} {(diff.act)}) (C {(test_cmp)} {(patch.exp)} {(commit.act)}) ] ) ] spids: [114] ) spids: [109 113] ) (FuncDef name: test_strip_patch_header body: (BraceGroup children: [(C {(sed)} {(-n)} {(SQ <'/^@@/,$p'>)} {($ VSub_Star '$*')})] spids: [291] ) spids: [286 290] ) (FuncDef name: dh_test_setup_history body: (BraceGroup children: [ (AndOr ops: [ Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp ] children: [ (SimpleCommand words: [{(echo)} {(DQ (file1))}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file1)} spids:[375])] ) (SimpleCommand words: [{(echo)} {(DQ (file2))}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file2)} spids:[387])] ) (SimpleCommand words: [{(echo)} {(DQ (file3))}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file3)} spids:[399])] ) (SimpleCommand words: [{(cat)} {(file1)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file)} spids:[410])] ) (C {(git)} {(add)} {(file)}) (C {(git)} {(commit)} {(-m)} {(DQ (D))}) (C {(git)} {(checkout)} {(-b)} {(branch)}) (SimpleCommand words: [{(cat)} {(file2)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file)} spids:[454])] ) (C {(git)} {(commit)} {(-a)} {(-m)} {(DQ (A))}) (C {(git)} {(checkout)} {(master)}) (SimpleCommand words: [{(cat)} {(file2)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file)} spids:[489])] ) (C {(git)} {(commit)} {(-a)} {(-m)} {(DQ (E))}) (SimpleCommand words: [{(cat)} {(file3)}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(file)} spids:[515])] ) (C {(git)} {(commit)} {(-a)} {(-m)} {(DQ (F))}) ] ) ] spids: [366] ) spids: [361 365] ) (FuncDef name: left_trim body: (BraceGroup children: [(C {(DQ ($ VSub_Name '$PERL_PATH'))} {(-pe)} {(SQ <'s/^\\s+//'>)})] spids: [541] ) spids: [536 540] ) (FuncDef name: trim_graph body: (BraceGroup children: [ (C {(DQ ($ VSub_Name '$PERL_PATH'))} {(-pe)} {(SQ <'s@^((\\*|\\|)( |/|\\\\))+@@'>)}) ] spids: [562] ) spids: [557 561] ) (C {(test_expect_success)} {(SQ <'diff-highlight highlights the beginning of a line'>)} { (SQ <'\n'> <'\tcat >a <<-\\EOF &&\n'> <'\t\taaa\n'> <'\t\tbbb\n'> <'\t\tccc\n'> <'\tEOF\n'> <'\n'> <'\tcat >b <<-\\EOF &&\n'> <'\t\taaa\n'> <'\t\t0bb\n'> <'\t\tccc\n'> <'\tEOF\n'> <'\n'> <'\tdh_test a b <<-EOF\n'> <'\t\t@@ -1,3 +1,3 @@\n'> <'\t\t aaa\n'> <'\t\t-${CW}b${CR}bb\n'> <'\t\t+${CW}0${CR}bb\n'> <'\t\t ccc\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff-highlight highlights the end of a line'>)} { (SQ <'\n'> <'\tcat >a <<-\\EOF &&\n'> <'\t\taaa\n'> <'\t\tbbb\n'> <'\t\tccc\n'> <'\tEOF\n'> <'\n'> <'\tcat >b <<-\\EOF &&\n'> <'\t\taaa\n'> <'\t\tbb0\n'> <'\t\tccc\n'> <'\tEOF\n'> <'\n'> <'\tdh_test a b <<-EOF\n'> <'\t\t@@ -1,3 +1,3 @@\n'> <'\t\t aaa\n'> <'\t\t-bb${CW}b${CR}\n'> <'\t\t+bb${CW}0${CR}\n'> <'\t\t ccc\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff-highlight highlights the middle of a line'>)} { (SQ <'\n'> <'\tcat >a <<-\\EOF &&\n'> <'\t\taaa\n'> <'\t\tbbb\n'> <'\t\tccc\n'> <'\tEOF\n'> <'\n'> <'\tcat >b <<-\\EOF &&\n'> <'\t\taaa\n'> <'\t\tb0b\n'> <'\t\tccc\n'> <'\tEOF\n'> <'\n'> <'\tdh_test a b <<-EOF\n'> <'\t\t@@ -1,3 +1,3 @@\n'> <'\t\t aaa\n'> <'\t\t-b${CW}b${CR}b\n'> <'\t\t+b${CW}0${CR}b\n'> <'\t\t ccc\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff-highlight does not highlight whole line'>)} { (SQ <'\n'> <'\tcat >a <<-\\EOF &&\n'> <'\t\taaa\n'> <'\t\tbbb\n'> <'\t\tccc\n'> <'\tEOF\n'> <'\n'> <'\tcat >b <<-\\EOF &&\n'> <'\t\taaa\n'> <'\t\t000\n'> <'\t\tccc\n'> <'\tEOF\n'> <'\n'> <'\tdh_test a b <<-EOF\n'> <'\t\t@@ -1,3 +1,3 @@\n'> <'\t\t aaa\n'> <'\t\t-bbb\n'> <'\t\t+000\n'> <'\t\t ccc\n'> <'\tEOF\n'> ) } ) (C {(test_expect_failure)} {(SQ <'diff-highlight highlights mismatched hunk size'>)} { (SQ <'\n'> <'\tcat >a <<-\\EOF &&\n'> <'\t\taaa\n'> <'\t\tbbb\n'> <'\tEOF\n'> <'\n'> <'\tcat >b <<-\\EOF &&\n'> <'\t\taaa\n'> <'\t\tb0b\n'> <'\t\tccc\n'> <'\tEOF\n'> <'\n'> <'\tdh_test a b <<-EOF\n'> <'\t\t@@ -1,3 +1,3 @@\n'> <'\t\t aaa\n'> <'\t\t-b${CW}b${CR}b\n'> <'\t\t+b${CW}0${CR}b\n'> <'\t\t+ccc\n'> <'\tEOF\n'> ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:o_accent) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(printf)} {(SQ <'\\303\\263'>)})]) left_token: <Left_CommandSub '$('> spids: [748 754] ) } spids: [747] ) ] spids: [747] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:o_stroke) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(printf)} {(SQ <'\\303\\270'>)})]) left_token: <Left_CommandSub '$('> spids: [760 766] ) } spids: [759] ) ] spids: [759] ) (C {(test_expect_success)} {(SQ <'diff-highlight treats multibyte utf-8 as a unit'>)} { (SQ <'\n'> <'\techo "unic${o_accent}de" >a &&\n'> <'\techo "unic${o_stroke}de" >b &&\n'> <'\tdh_test a b <<-EOF\n'> <'\t\t@@ -1 +1 @@\n'> <'\t\t-unic${CW}${o_accent}${CR}de\n'> <'\t\t+unic${CW}${o_stroke}${CR}de\n'> <'\tEOF\n'> ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:combine_accent) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(printf)} {(SQ <'\\314\\201'>)})]) left_token: <Left_CommandSub '$('> spids: [800 806] ) } spids: [799] ) ] spids: [799] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:combine_circum) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(printf)} {(SQ <'\\314\\202'>)})]) left_token: <Left_CommandSub '$('> spids: [812 818] ) } spids: [811] ) ] spids: [811] ) (C {(test_expect_failure)} {(SQ <'diff-highlight treats combining code points as a unit'>)} { (SQ <'\n'> <'\techo "unico${combine_accent}de" >a &&\n'> <'\techo "unico${combine_circum}de" >b &&\n'> <'\tdh_test a b <<-EOF\n'> <'\t\t@@ -1 +1 @@\n'> <'\t\t-unic${CW}o${combine_accent}${CR}de\n'> <'\t\t+unic${CW}o${combine_circum}${CR}de\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff-highlight works with the --graph option'>)} { (SQ <'\n'> <'\tdh_test_setup_history &&\n'> <'\n'> <'\t# topo-order so that the order of the commits is the same as with --graph\n'> <'\t# trim graph elements so we can do a diff\n'> <'\t# trim leading space because our trim_graph is not perfect\n'> <'\tgit log --branches -p --topo-order |\n'> <'\t\t"$DIFF_HIGHLIGHT" | left_trim >graph.exp &&\n'> <'\tgit log --branches -p --graph |\n'> <'\t\t"$DIFF_HIGHLIGHT" | trim_graph | left_trim >graph.act &&\n'> <'\ttest_cmp graph.exp graph.act\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff-highlight ignores combined diffs'>)} { (SQ <'\n'> <'\techo "content" >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m base &&\n'> <'\n'> <'\t>file &&\n'> <'\tgit commit -am master &&\n'> <'\n'> <'\tgit checkout -b other HEAD^ &&\n'> <'\techo "modified content" >file &&\n'> <'\tgit commit -am other &&\n'> <'\n'> <'\ttest_must_fail git merge master &&\n'> <'\techo "resolved content" >file &&\n'> <'\tgit commit -am resolved &&\n'> <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\t--- a/file\n'> <'\t+++ b/file\n'> <'\t@@@ -1,1 -1,0 +1,1 @@@\n'> <'\t- modified content\n'> <'\t++resolved content\n'> <'\tEOF\n'> <'\n'> <'\tgit show -c | "$DIFF_HIGHLIGHT" >actual.raw &&\n'> <'\tsed -n "/^---/,\\$p" <actual.raw >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_done)}) ] )