(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'git-difftool\n'> <'\n'> <'Testing basic diff tool invocation\n'>)} spids: [13] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: difftool_test_setup body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<test_config>} {<diff.tool>} {<test-tool>}) (C {<test_config>} {<difftool.test-tool.cmd>} {(SQ <'cat "$LOCAL"'>)}) (C {<test_config>} {<difftool.bogus-tool.cmd>} {<false>}) ] ) ] ) ) (command.ShFunction name: prompt_given body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:prompt) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [71] ) ] ) (C {<test>} {(DQ ($ Id.VSub_DollarName '$prompt'))} {<Id.Lit_Equals '='>} {(DQ <'Launch \'test-tool\' [Y/n]? branch'>)} ) ] ) ) (C {<test_expect_success>} {<PERL>} {(SQ <setup>)} { (SQ <'\n'> <'\techo master >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m "added file" &&\n'> <'\n'> <'\tgit checkout -b branch master &&\n'> <'\techo branch >file &&\n'> <'\tgit commit -a -m "branch changed file" &&\n'> <'\tgit checkout master\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'custom commands'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\ttest_config difftool.test-tool.cmd "cat \\"\\$REMOTE\\"" &&\n'> <'\techo master >expect &&\n'> <'\tgit difftool --no-prompt branch >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\n'> <'\ttest_config difftool.test-tool.cmd "cat \\"\\$LOCAL\\"" &&\n'> <'\techo branch >expect &&\n'> <'\tgit difftool --no-prompt branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'custom tool commands override built-ins'>)} { (SQ <'\n'> <'\ttest_config difftool.vimdiff.cmd "cat \\"\\$REMOTE\\"" &&\n'> <'\techo master >expect &&\n'> <'\tgit difftool --tool vimdiff --no-prompt branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool ignores bad --tool values'>)} { (SQ <'\n'> <'\t: >expect &&\n'> <'\ttest_must_fail \\\n'> <'\t\tgit difftool --no-prompt --tool=bad-tool branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool forwards arguments to diff'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\t>for-diff &&\n'> <'\tgit add for-diff &&\n'> <'\techo changes>for-diff &&\n'> <'\tgit add for-diff &&\n'> <'\t: >expect &&\n'> <'\tgit difftool --cached --no-prompt -- for-diff >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\tgit reset -- for-diff &&\n'> <'\trm for-diff\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool ignores exit code'>)} { (SQ <'\n'> <'\ttest_config difftool.error.cmd false &&\n'> <'\tgit difftool -y -t error branch\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool forwards exit code with --trust-exit-code'>)} { (SQ <'\n'> <'\ttest_config difftool.error.cmd false &&\n'> <'\ttest_must_fail git difftool -y --trust-exit-code -t error branch\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool forwards exit code with --trust-exit-code for built-ins'>)} { (SQ <'\n'> <'\ttest_config difftool.vimdiff.path false &&\n'> <'\ttest_must_fail git difftool -y --trust-exit-code -t vimdiff branch\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool honors difftool.trustExitCode = true'>)} { (SQ <'\n'> <'\ttest_config difftool.error.cmd false &&\n'> <'\ttest_config difftool.trustExitCode true &&\n'> <'\ttest_must_fail git difftool -y -t error branch\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool honors difftool.trustExitCode = false'>)} { (SQ <'\n'> <'\ttest_config difftool.error.cmd false &&\n'> <'\ttest_config difftool.trustExitCode false &&\n'> <'\tgit difftool -y -t error branch\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool ignores exit code with --no-trust-exit-code'>)} { (SQ <'\n'> <'\ttest_config difftool.error.cmd false &&\n'> <'\ttest_config difftool.trustExitCode true &&\n'> <'\tgit difftool -y --no-trust-exit-code -t error branch\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool stops on error with --trust-exit-code'>)} { (SQ <'\n'> <'\ttest_when_finished "rm -f for-diff .git/fail-right-file" &&\n'> <'\ttest_when_finished "git reset -- for-diff" &&\n'> <'\twrite_script .git/fail-right-file <<-\\EOF &&\n'> <'\techo "$2"\n'> <'\texit 1\n'> <'\tEOF\n'> <'\t>for-diff &&\n'> <'\tgit add for-diff &&\n'> <'\techo file >expect &&\n'> <'\ttest_must_fail git difftool -y --trust-exit-code \\\n'> <'\t\t--extcmd .git/fail-right-file branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool honors exit status if command not found'>)} { (SQ <'\n'> <'\ttest_config difftool.nonexistent.cmd i-dont-exist &&\n'> <'\ttest_config difftool.trustExitCode false &&\n'> <'\ttest_must_fail git difftool -y -t nonexistent branch\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool honors --gui'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\ttest_config merge.tool bogus-tool &&\n'> <'\ttest_config diff.tool bogus-tool &&\n'> <'\ttest_config diff.guitool test-tool &&\n'> <'\n'> <'\techo branch >expect &&\n'> <'\tgit difftool --no-prompt --gui branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool --gui last setting wins'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\t: >expect &&\n'> <'\tgit difftool --no-prompt --gui --no-gui >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\n'> <'\ttest_config merge.tool bogus-tool &&\n'> <'\ttest_config diff.tool bogus-tool &&\n'> <'\ttest_config diff.guitool test-tool &&\n'> <'\techo branch >expect &&\n'> <'\tgit difftool --no-prompt --no-gui --gui branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool --gui works without configured diff.guitool'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\techo branch >expect &&\n'> <'\tgit difftool --no-prompt --gui branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'GIT_DIFF_TOOL variable'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\tgit config --unset diff.tool &&\n'> <'\techo branch >expect &&\n'> <'\tGIT_DIFF_TOOL=test-tool git difftool --no-prompt branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'GIT_DIFF_TOOL overrides'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\ttest_config diff.tool bogus-tool &&\n'> <'\ttest_config merge.tool bogus-tool &&\n'> <'\n'> <'\techo branch >expect &&\n'> <'\tGIT_DIFF_TOOL=test-tool git difftool --no-prompt branch >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\n'> <'\ttest_config diff.tool bogus-tool &&\n'> <'\ttest_config merge.tool bogus-tool &&\n'> <'\tGIT_DIFF_TOOL=bogus-tool \\\n'> <'\t\tgit difftool --no-prompt --tool=test-tool branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'GIT_DIFFTOOL_NO_PROMPT variable'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\techo branch >expect &&\n'> <'\tGIT_DIFFTOOL_NO_PROMPT=true git difftool branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'GIT_DIFFTOOL_PROMPT variable'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\ttest_config difftool.prompt false &&\n'> <'\techo >input &&\n'> <'\tGIT_DIFFTOOL_PROMPT=true git difftool branch <input >output &&\n'> <'\tprompt=$(tail -1 <output) &&\n'> <'\tprompt_given "$prompt"\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool.prompt config variable is false'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\ttest_config difftool.prompt false &&\n'> <'\techo branch >expect &&\n'> <'\tgit difftool branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool merge.prompt = false'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\ttest_might_fail git config --unset difftool.prompt &&\n'> <'\ttest_config mergetool.prompt false &&\n'> <'\techo branch >expect &&\n'> <'\tgit difftool branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool.prompt can overridden with -y'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\ttest_config difftool.prompt true &&\n'> <'\techo branch >expect &&\n'> <'\tgit difftool -y branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool.prompt can overridden with --prompt'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\ttest_config difftool.prompt false &&\n'> <'\techo >input &&\n'> <'\tgit difftool --prompt branch <input >output &&\n'> <'\tprompt=$(tail -1 <output) &&\n'> <'\tprompt_given "$prompt"\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool last flag wins'>)} { (SQ <'\n'> <'\tdifftool_test_setup &&\n'> <'\techo branch >expect &&\n'> <'\tgit difftool --prompt --no-prompt branch >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\techo >input &&\n'> <'\tgit difftool --no-prompt --prompt branch <input >output &&\n'> <'\tprompt=$(tail -1 <output) &&\n'> <'\tprompt_given "$prompt"\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool + mergetool config variables'>)} { (SQ <'\n'> <'\ttest_config merge.tool test-tool &&\n'> <'\ttest_config mergetool.test-tool.cmd "cat \\$LOCAL" &&\n'> <'\techo branch >expect &&\n'> <'\tgit difftool --no-prompt branch >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\n'> <'\t# set merge.tool to something bogus, diff.tool to test-tool\n'> <'\ttest_config merge.tool bogus-tool &&\n'> <'\ttest_config diff.tool test-tool &&\n'> <'\tgit difftool --no-prompt branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool.<tool>.path'>)} { (SQ <'\n'> <'\ttest_config difftool.tkdiff.path echo &&\n'> <'\tgit difftool --tool=tkdiff --no-prompt branch >output &&\n'> <'\tlines=$(grep file output | wc -l) &&\n'> <'\ttest "$lines" -eq 1\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool --extcmd=cat'>)} { (SQ <'\n'> <'\techo branch >expect &&\n'> <'\techo master >>expect &&\n'> <'\tgit difftool --no-prompt --extcmd=cat branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool --extcmd cat'>)} { (SQ <'\n'> <'\techo branch >expect &&\n'> <'\techo master >>expect &&\n'> <'\tgit difftool --no-prompt --extcmd=cat branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool -x cat'>)} { (SQ <'\n'> <'\techo branch >expect &&\n'> <'\techo master >>expect &&\n'> <'\tgit difftool --no-prompt -x cat branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool --extcmd echo arg1'>)} { (SQ <'\n'> <'\techo file >expect &&\n'> <'\tgit difftool --no-prompt \\\n'> <'\t\t--extcmd sh\\ -c\\ \\"echo\\ \\$1\\" branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool --extcmd cat arg1'>)} { (SQ <'\n'> <'\techo master >expect &&\n'> <'\tgit difftool --no-prompt \\\n'> <'\t\t--extcmd sh\\ -c\\ \\"cat\\ \\$1\\" branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool --extcmd cat arg2'>)} { (SQ <'\n'> <'\techo branch >expect &&\n'> <'\tgit difftool --no-prompt \\\n'> <'\t\t--extcmd sh\\ -c\\ \\"cat\\ \\$2\\" branch >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'setup with 2 files different'>)} { (SQ <'\n'> <'\techo m2 >file2 &&\n'> <'\tgit add file2 &&\n'> <'\tgit commit -m "added file2" &&\n'> <'\n'> <'\tgit checkout branch &&\n'> <'\techo br2 >file2 &&\n'> <'\tgit add file2 &&\n'> <'\tgit commit -a -m "branch changed file2" &&\n'> <'\tgit checkout master\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'say no to the first file'>)} { (SQ <'\n'> <'\t(echo n && echo) >input &&\n'> <'\tgit difftool -x cat branch <input >output &&\n'> <'\tgrep m2 output &&\n'> <'\tgrep br2 output &&\n'> <'\t! grep master output &&\n'> <'\t! grep branch output\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'say no to the second file'>)} { (SQ <'\n'> <'\t(echo && echo n) >input &&\n'> <'\tgit difftool -x cat branch <input >output &&\n'> <'\tgrep master output &&\n'> <'\tgrep branch output &&\n'> <'\t! grep m2 output &&\n'> <'\t! grep br2 output\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'ending prompt input with EOF'>)} { (SQ <'\n'> <'\tgit difftool -x cat branch </dev/null >output &&\n'> <'\t! grep master output &&\n'> <'\t! grep branch output &&\n'> <'\t! grep m2 output &&\n'> <'\t! grep br2 output\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool --tool-help'>)} {(SQ <'\n'> <'\tgit difftool --tool-help >output &&\n'> <'\tgrep tool output\n'>)} ) (C {<test_expect_success>} {<PERL>} {(SQ <'setup change in subdirectory'>)} { (SQ <'\n'> <'\tgit checkout master &&\n'> <'\tmkdir sub &&\n'> <'\techo master >sub/sub &&\n'> <'\tgit add sub/sub &&\n'> <'\tgit commit -m "added sub/sub" &&\n'> <'\techo test >>file &&\n'> <'\techo test >>sub/sub &&\n'> <'\tgit add file sub/sub &&\n'> <'\tgit commit -m "modified both"\n'> ) } ) (command.ShFunction name: run_dir_diff_test body: (BraceGroup children: [ (C {<test_expect_success>} {<PERL>} {(DQ ($ Id.VSub_Number '$1') <' --no-symlinks'>)} { (DQ <'\n'> <'\t\tsymlinks=--no-symlinks &&\n'> <'\t\t'> ($ Id.VSub_Number '$2') <'\n'> <'\t'> ) } ) (C {<test_expect_success>} {<PERL> <Id.Lit_Comma ','> <SYMLINKS>} {(DQ ($ Id.VSub_Number '$1') <' --symlinks'>)} {(DQ <'\n'> <'\t\tsymlinks=--symlinks &&\n'> <'\t\t'> ($ Id.VSub_Number '$2') <'\n'> <'\t'>)} ) ] ) ) (C {<run_dir_diff_test>} {(SQ <'difftool -d'>)} { (SQ <'\n'> <'\tgit difftool -d $symlinks --extcmd ls branch >output &&\n'> <'\tgrep sub output &&\n'> <'\tgrep file output\n'> ) } ) (C {<run_dir_diff_test>} {(SQ <'difftool --dir-diff'>)} { (SQ <'\n'> <'\tgit difftool --dir-diff $symlinks --extcmd ls branch >output &&\n'> <'\tgrep sub output &&\n'> <'\tgrep file output\n'> ) } ) (C {<run_dir_diff_test>} {(SQ <'difftool --dir-diff ignores --prompt'>)} { (SQ <'\n'> <'\tgit difftool --dir-diff $symlinks --prompt --extcmd ls branch >output &&\n'> <'\tgrep sub output &&\n'> <'\tgrep file output\n'> ) } ) (C {<run_dir_diff_test>} {(SQ <'difftool --dir-diff from subdirectory'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\tgit difftool --dir-diff $symlinks --extcmd ls branch >output &&\n'> <'\t\tgrep sub output &&\n'> <'\t\tgrep file output\n'> <'\t)\n'> ) } ) (C {<run_dir_diff_test>} {(SQ <'difftool --dir-diff from subdirectory with GIT_DIR set'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tGIT_DIR=$(pwd)/.git &&\n'> <'\t\texport GIT_DIR &&\n'> <'\t\tGIT_WORK_TREE=$(pwd) &&\n'> <'\t\texport GIT_WORK_TREE &&\n'> <'\t\tcd sub &&\n'> <'\t\tgit difftool --dir-diff $symlinks --extcmd ls \\\n'> <'\t\t\tbranch -- sub >output &&\n'> <'\t\tgrep sub output &&\n'> <'\t\t! grep file output\n'> <'\t)\n'> ) } ) (C {<run_dir_diff_test>} {(SQ <'difftool --dir-diff when worktree file is missing'>)} { (SQ <'\n'> <'\ttest_when_finished git reset --hard &&\n'> <'\trm file2 &&\n'> <'\tgit difftool --dir-diff $symlinks --extcmd ls branch master >output &&\n'> <'\tgrep file2 output\n'> ) } ) (C {<run_dir_diff_test>} {(SQ <'difftool --dir-diff with unmerged files'>)} { (SQ <'\n'> <'\ttest_when_finished git reset --hard &&\n'> <'\ttest_config difftool.echo.cmd "echo ok" &&\n'> <'\tgit checkout -B conflict-a &&\n'> <'\tgit checkout -B conflict-b &&\n'> <'\tgit checkout conflict-a &&\n'> <'\techo a >>file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m conflict-a &&\n'> <'\tgit checkout conflict-b &&\n'> <'\techo b >>file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m conflict-b &&\n'> <'\tgit checkout master &&\n'> <'\tgit merge conflict-a &&\n'> <'\ttest_must_fail git merge conflict-b &&\n'> <'\tcat >expect <<-EOF &&\n'> <'\t\tok\n'> <'\tEOF\n'> <'\tgit difftool --dir-diff $symlinks -t echo >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (command.Simple words: [{<write_script>} {<'.git/CHECK_SYMLINKS'>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 1063 stdin_parts: [ <'for f in file file2 sub/sub\n'> <'do\n'> <'\techo "$f"\n'> <'\tls -ld "$2/$f" | sed -e \'s/.* -> //\'\n'> <'done >actual\n'> ] ) ) ] do_fork: T ) (C {<test_expect_success>} {<PERL> <Id.Lit_Comma ','> <SYMLINKS>} {(SQ <'difftool --dir-diff --symlink without unstaged changes'>)} { (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tfile\n'> <'\t$PWD/file\n'> <'\tfile2\n'> <'\t$PWD/file2\n'> <'\tsub/sub\n'> <'\t$PWD/sub/sub\n'> <'\tEOF\n'> <'\tgit difftool --dir-diff --symlink \\\n'> <'\t\t--extcmd "./.git/CHECK_SYMLINKS" branch HEAD &&\n'> <'\ttest_cmp actual expect\n'> ) } ) (command.Simple words: [{<write_script>} {<modify-right-file>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 1100 stdin_parts: [<'echo "new content" >"$2/file"\n'>] ) ) ] do_fork: T ) (C {<run_dir_diff_test>} {(SQ <'difftool --dir-diff syncs worktree with unstaged change'>)} { (SQ <'\n'> <'\ttest_when_finished git reset --hard &&\n'> <'\techo "orig content" >file &&\n'> <'\tgit difftool -d $symlinks --extcmd "$PWD/modify-right-file" branch &&\n'> <'\techo "new content" >expect &&\n'> <'\ttest_cmp expect file\n'> ) } ) (C {<run_dir_diff_test>} {(SQ <'difftool --dir-diff syncs worktree without unstaged change'>)} { (SQ <'\n'> <'\ttest_when_finished git reset --hard &&\n'> <'\tgit difftool -d $symlinks --extcmd "$PWD/modify-right-file" branch &&\n'> <'\techo "new content" >expect &&\n'> <'\ttest_cmp expect file\n'> ) } ) (command.Simple words: [{<write_script>} {<modify-file>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 1142 stdin_parts: [<'echo "new content" >file\n'>] ) ) ] do_fork: T ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool --no-symlinks does not overwrite working tree file '>)} { (SQ <'\n'> <'\techo "orig content" >file &&\n'> <'\tgit difftool --dir-diff --no-symlinks --extcmd "$PWD/modify-file" branch &&\n'> <'\techo "new content" >expect &&\n'> <'\ttest_cmp expect file\n'> ) } ) (command.Simple words: [{<write_script>} {<modify-both-files>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 1172 stdin_parts: [ <'echo "wt content" >file &&\n'> <'echo "tmp content" >"$2/file" &&\n'> <'echo "$2" >tmpdir\n'> ] ) ) ] do_fork: T ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool --no-symlinks detects conflict '>)} { (SQ <'\n'> <'\t(\n'> <'\t\tTMPDIR=$TRASH_DIRECTORY &&\n'> <'\t\texport TMPDIR &&\n'> <'\t\techo "orig content" >file &&\n'> < '\t\ttest_must_fail git difftool --dir-diff --no-symlinks --extcmd "$PWD/modify-both-files" branch &&\n' > <'\t\techo "wt content" >expect &&\n'> <'\t\ttest_cmp expect file &&\n'> <'\t\techo "tmp content" >expect &&\n'> <'\t\ttest_cmp expect "$(cat tmpdir)/file"\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {<PERL>} {(SQ <'difftool properly honors gitlink and core.worktree'>)} { (SQ <'\n'> <'\tgit submodule add ./. submod/ule &&\n'> <'\ttest_config -C submod/ule diff.tool checktrees &&\n'> <'\ttest_config -C submod/ule difftool.checktrees.cmd '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <'\n'> <'\t\ttest -d "$LOCAL" && test -d "$REMOTE" && echo good\n'> <'\t\t'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''>) (SQ <' &&\n'> <'\t(\n'> <'\t\tcd submod/ule &&\n'> <'\t\techo good >expect &&\n'> <'\t\tgit difftool --tool=checktrees --dir-diff HEAD~ >actual &&\n'> <'\t\ttest_cmp expect actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {<PERL> <Id.Lit_Comma ','> <SYMLINKS>} {(SQ <'difftool --dir-diff symlinked directories'>)} { (SQ <'\n'> <'\tgit init dirlinks &&\n'> <'\t(\n'> <'\t\tcd dirlinks &&\n'> <'\t\tgit config diff.tool checktrees &&\n'> <'\t\tgit config difftool.checktrees.cmd "echo good" &&\n'> <'\t\tmkdir foo &&\n'> <'\t\t: >foo/bar &&\n'> <'\t\tgit add foo/bar &&\n'> <'\t\ttest_commit symlink-one &&\n'> <'\t\tln -s foo link &&\n'> <'\t\tgit add link &&\n'> <'\t\ttest_commit symlink-two &&\n'> <'\t\techo good >expect &&\n'> <'\t\tgit difftool --tool=checktrees --dir-diff HEAD~ >actual &&\n'> <'\t\ttest_cmp expect actual\n'> <'\t)\n'> ) } ) (C {<test_done>}) ] )