(command.CommandList children: [ (command.ShAssignment left: <Id.Lit_VarLike 'test_description='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'test_description='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'external diff interface test'>)} ) ] redirects: [] ) (command.Simple blame_tok: <.> more_env: [] words: [{<.>} {<'./test-lib.sh'>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\n'> <'\ttest_tick &&\n'> <'\techo initial >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m initial &&\n'> <'\n'> <'\ttest_tick &&\n'> <'\techo second >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m second &&\n'> <'\n'> <'\ttest_tick &&\n'> <'\techo third >file\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'GIT_EXTERNAL_DIFF environment'>)} { (SQ <'\n'> <'\n'> <'\tGIT_EXTERNAL_DIFF=echo git diff | {\n'> <'\t\tread path oldfile oldhex oldmode newfile newhex newmode &&\n'> <'\t\ttest "z$path" = zfile &&\n'> <'\t\ttest "z$oldmode" = z100644 &&\n'> <'\t\ttest "z$newhex" = "z$_z40" &&\n'> <'\t\ttest "z$newmode" = z100644 &&\n'> <'\t\toh=$(git rev-parse --verify HEAD:file) &&\n'> <'\t\ttest "z$oh" = "z$oldhex"\n'> <'\t}\n'> <'\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'GIT_EXTERNAL_DIFF environment should apply only to diff'>)} { (SQ <'\n'> <'\n'> <'\tGIT_EXTERNAL_DIFF=echo git log -p -1 HEAD |\n'> <'\tgrep "^diff --git a/file b/file"\n'> <'\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'GIT_EXTERNAL_DIFF environment and --no-ext-diff'>)} { (SQ <'\n'> <'\n'> <'\tGIT_EXTERNAL_DIFF=echo git diff --no-ext-diff |\n'> <'\tgrep "^diff --git a/file b/file"\n'> <'\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {<SYMLINKS>} {(SQ <'typechange diff'>)} { (SQ <'\n'> <'\trm -f file &&\n'> <'\tln -s elif file &&\n'> <'\tGIT_EXTERNAL_DIFF=echo git diff | {\n'> <'\t\tread path oldfile oldhex oldmode newfile newhex newmode &&\n'> <'\t\ttest "z$path" = zfile &&\n'> <'\t\ttest "z$oldmode" = z100644 &&\n'> <'\t\ttest "z$newhex" = "z$_z40" &&\n'> <'\t\ttest "z$newmode" = z120000 &&\n'> <'\t\toh=$(git rev-parse --verify HEAD:file) &&\n'> <'\t\ttest "z$oh" = "z$oldhex"\n'> <'\t} &&\n'> <'\tGIT_EXTERNAL_DIFF=echo git diff --no-ext-diff >actual &&\n'> <'\tgit diff >expect &&\n'> <'\ttest_cmp expect actual\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <diff.external>)} { (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\techo third >file &&\n'> <'\ttest_config diff.external echo &&\n'> <'\tgit diff | {\n'> <'\t\tread path oldfile oldhex oldmode newfile newhex newmode &&\n'> <'\t\ttest "z$path" = zfile &&\n'> <'\t\ttest "z$oldmode" = z100644 &&\n'> <'\t\ttest "z$newhex" = "z$_z40" &&\n'> <'\t\ttest "z$newmode" = z100644 &&\n'> <'\t\toh=$(git rev-parse --verify HEAD:file) &&\n'> <'\t\ttest "z$oh" = "z$oldhex"\n'> <'\t}\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'diff.external should apply only to diff'>)} { (SQ <'\n'> <'\ttest_config diff.external echo &&\n'> <'\tgit log -p -1 HEAD |\n'> <'\tgrep "^diff --git a/file b/file"\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'diff.external and --no-ext-diff'>)} { (SQ <'\n'> <'\ttest_config diff.external echo &&\n'> <'\tgit diff --no-ext-diff |\n'> <'\tgrep "^diff --git a/file b/file"\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'diff attribute'>)} { (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\techo third >file &&\n'> <'\n'> <'\tgit config diff.parrot.command echo &&\n'> <'\n'> <'\techo >.gitattributes "file diff=parrot" &&\n'> <'\n'> <'\tgit diff | {\n'> <'\t\tread path oldfile oldhex oldmode newfile newhex newmode &&\n'> <'\t\ttest "z$path" = zfile &&\n'> <'\t\ttest "z$oldmode" = z100644 &&\n'> <'\t\ttest "z$newhex" = "z$_z40" &&\n'> <'\t\ttest "z$newmode" = z100644 &&\n'> <'\t\toh=$(git rev-parse --verify HEAD:file) &&\n'> <'\t\ttest "z$oh" = "z$oldhex"\n'> <'\t}\n'> <'\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'diff attribute should apply only to diff'>)} { (SQ <'\n'> <'\n'> <'\tgit log -p -1 HEAD |\n'> <'\tgrep "^diff --git a/file b/file"\n'> <'\n'>) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'diff attribute and --no-ext-diff'>)} { (SQ <'\n'> <'\n'> <'\tgit diff --no-ext-diff |\n'> <'\tgrep "^diff --git a/file b/file"\n'> <'\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'diff attribute'>)} { (SQ <'\n'> <'\n'> <'\tgit config --unset diff.parrot.command &&\n'> <'\tgit config diff.color.command echo &&\n'> <'\n'> <'\techo >.gitattributes "file diff=color" &&\n'> <'\n'> <'\tgit diff | {\n'> <'\t\tread path oldfile oldhex oldmode newfile newhex newmode &&\n'> <'\t\ttest "z$path" = zfile &&\n'> <'\t\ttest "z$oldmode" = z100644 &&\n'> <'\t\ttest "z$newhex" = "z$_z40" &&\n'> <'\t\ttest "z$newmode" = z100644 &&\n'> <'\t\toh=$(git rev-parse --verify HEAD:file) &&\n'> <'\t\ttest "z$oh" = "z$oldhex"\n'> <'\t}\n'> <'\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'diff attribute should apply only to diff'>)} { (SQ <'\n'> <'\n'> <'\tgit log -p -1 HEAD |\n'> <'\tgrep "^diff --git a/file b/file"\n'> <'\n'>) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'diff attribute and --no-ext-diff'>)} { (SQ <'\n'> <'\n'> <'\tgit diff --no-ext-diff |\n'> <'\tgrep "^diff --git a/file b/file"\n'> <'\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'GIT_EXTERNAL_DIFF trumps diff.external'>)} { (SQ <'\n'> <'\t>.gitattributes &&\n'> <'\ttest_config diff.external "echo ext-global" &&\n'> <'\tGIT_EXTERNAL_DIFF="echo ext-env" git diff | grep ext-env\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'attributes trump GIT_EXTERNAL_DIFF and diff.external'>)} { (SQ <'\n'> <'\ttest_config diff.foo.command "echo ext-attribute" &&\n'> <'\ttest_config diff.external "echo ext-global" &&\n'> <'\techo "file diff=foo" >.gitattributes &&\n'> <'\tGIT_EXTERNAL_DIFF="echo ext-env" git diff | grep ext-attribute\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'no diff with -diff'>)} {(SQ <'\n'> <'\techo >.gitattributes "file -diff" &&\n'> <'\tgit diff | grep Binary\n'>)} ] redirects: [] do_fork: T ) (command.Pipeline children: [ (command.Simple blame_tok: <echo> more_env: [] words: [{<echo>} {<NULZbetweenZwords>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <perl> more_env: [] words: [{<perl>} {<-pe>} {(SQ <'y/Z/\\000/'>)}] redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file>})] do_fork: T ) ] ops: [<Id.Op_Pipe _>] ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'force diff with "diff"'>)} { (SQ <'\n'> <'\techo >.gitattributes "file diff" &&\n'> <'\tgit diff >actual &&\n'> <'\ttest_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'GIT_EXTERNAL_DIFF with more than one changed files'>)} { (SQ <'\n'> <'\techo anotherfile > file2 &&\n'> <'\tgit add file2 &&\n'> <'\tgit commit -m "added 2nd file" &&\n'> <'\techo modified >file2 &&\n'> <'\tGIT_EXTERNAL_DIFF=echo git diff\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'GIT_EXTERNAL_DIFF path counter/total'>)} { (SQ <'\n'> <'\twrite_script external-diff.sh <<-\\EOF &&\n'> <'\techo $GIT_DIFF_PATH_COUNTER of $GIT_DIFF_PATH_TOTAL >>counter.txt\n'> <'\tEOF\n'> <'\t>counter.txt &&\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\t1 of 2\n'> <'\t2 of 2\n'> <'\tEOF\n'> <'\tGIT_EXTERNAL_DIFF=./external-diff.sh git diff &&\n'> <'\ttest_cmp expect counter.txt\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'GIT_EXTERNAL_DIFF generates pretty paths'>)} { (SQ <'\n'> <'\ttouch file.ext &&\n'> <'\tgit add file.ext &&\n'> <'\techo with extension > file.ext &&\n'> <'\tGIT_EXTERNAL_DIFF=echo git diff file.ext | grep ......_file\\.ext &&\n'> <'\tgit update-index --force-remove file.ext &&\n'> <'\trm file.ext\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <echo> more_env: [] words: [{<echo>} {(DQ <'#!'> ($ Id.VSub_DollarName SHELL_PATH))}] redirects: [(Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<fake-diff.sh>})] do_fork: T ) (command.Simple blame_tok: <cat> more_env: [] words: [{<cat>}] redirects: [ (Redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<fake-diff.sh>}) (Redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_tok: <Id.Undefined_Tok ''> stdin_parts: [<'cat $2 >> crlfed.txt\n'>] ) ) ] do_fork: T ) (command.Simple blame_tok: <chmod> more_env: [] words: [{<chmod>} {<a> <Id.Lit_Other '+'> <x>} {<fake-diff.sh>}] redirects: [] do_fork: T ) (command.ShFunction name_tok: <keep_only_cr> name: keep_only_cr body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <tr> more_env: [] words: [{<tr>} {<-dc>} {(SQ <'\\015'>)}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'external diff with autocrlf = true'>)} { (SQ <'\n'> <'\ttest_config core.autocrlf true &&\n'> <'\tGIT_EXTERNAL_DIFF=./fake-diff.sh git diff &&\n'> <'\ttest $(wc -l < crlfed.txt) = $(cat crlfed.txt | keep_only_cr | wc -c)\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'diff --cached'>)} { (SQ <'\n'> <'\ttest_config core.autocrlf true &&\n'> <'\tgit add file &&\n'> <'\tgit update-index --assume-unchanged file &&\n'> <'\techo second >file &&\n'> <'\tgit diff --cached >actual &&\n'> <'\ttest_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'clean up crlf leftovers'>)} { (SQ <'\n'> <'\tgit update-index --no-assume-unchanged file &&\n'> <'\trm -f file* &&\n'> <'\tgit reset --hard\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_expect_success> more_env: [] words: [ {<test_expect_success>} {(SQ <'submodule diff'>)} { (SQ <'\n'> <'\tgit init sub &&\n'> <'\t( cd sub && test_commit sub1 ) &&\n'> <'\tgit add sub &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "add submodule" &&\n'> <'\t( cd sub && test_commit sub2 ) &&\n'> <'\twrite_script gather_pre_post.sh <<-\\EOF &&\n'> <'\techo "$1 $4" # path, mode\n'> <'\tcat "$2" # old file\n'> <'\tcat "$5" # new file\n'> <'\tEOF\n'> <'\tGIT_EXTERNAL_DIFF=./gather_pre_post.sh git diff >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tsub 160000\n'> <'\tSubproject commit $(git rev-parse HEAD:sub)\n'> <'\tSubproject commit $(cd sub && git rev-parse HEAD)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <test_done> more_env: [] words: [{<test_done>}] redirects: [] do_fork: T ) ] )