{"thread":{"id":"32947","subject":"[PATCH v2 1/4] difftool: silence uninitialized variable warning","startedAt":"2013-02-20T05:35:25Z","lastAt":"2013-02-20T07:05:44Z","messageCount":5,"participants":["David Aguilar","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":4},"messages":[{"id":"209880","messageId":"1361338528-17835-1-git-send-email-davvid@gmail.com","threadId":"32947","inReplyTo":null,"subject":"[PATCH v2 1/4] difftool: silence uninitialized variable warning","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-02-20T05:35:25Z","receivedAt":"2013-02-20T05:35:25Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Git::config() returns `undef` when given keys that do not exist.\nCheck that the $guitool value is defined to prevent a noisy\n\"Use of uninitialized variable $guitool in length\" warning.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nUnchanged from last time but included in the series for convenience.\n\n git-difftool.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-difftool.perl b/git-difftool.perl\nindex 0a90de4..12231fb 100755\n--- a/git-difftool.perl\n+++ b/git-difftool.perl\n@@ -336,7 +336,7 @@ sub main\n \t}\n \tif ($opts{gui}) {\n \t\tmy $guitool = Git::config('diff.guitool');\n-\t\tif (length($guitool) > 0) {\n+\t\tif (defined($guitool) && length($guitool) > 0) {\n \t\t\t$ENV{GIT_DIFF_TOOL} = $guitool;\n \t\t}\n \t}\n-- \n1.8.2.rc0.20.gf548dd7\n"},{"id":"209881","messageId":"1361338528-17835-2-git-send-email-davvid@gmail.com","threadId":"32947","inReplyTo":"1361338528-17835-1-git-send-email-davvid@gmail.com","subject":"[PATCH v2 2/4] t7800: update copyright notice","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-02-20T05:35:26Z","receivedAt":"2013-02-20T05:35:26Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Signed-off-by: David Aguilar <davvid@gmail.com>\n---\n t/t7800-difftool.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh\nindex eb1d3f8..5b5939b 100755\n--- a/t/t7800-difftool.sh\n+++ b/t/t7800-difftool.sh\n@@ -1,6 +1,6 @@\n #!/bin/sh\n #\n-# Copyright (c) 2009, 2010 David Aguilar\n+# Copyright (c) 2009, 2010, 2012, 2013 David Aguilar\n #\n \n test_description='git-difftool\n-- \n1.8.2.rc0.20.gf548dd7\n"},{"id":"209882","messageId":"1361338528-17835-3-git-send-email-davvid@gmail.com","threadId":"32947","inReplyTo":"1361338528-17835-2-git-send-email-davvid@gmail.com","subject":"[PATCH v2 3/4] t7800: modernize tests","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-02-20T05:35:27Z","receivedAt":"2013-02-20T05:35:27Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Eliminate a lot of redundant work by using test_config().\nCatch more return codes by more use of temporary files\nand test_cmp.\n\nThe original tests relied upon restore_test_defaults()\nfrom the previous test to provide the next test with a sane\nenvironment.  Make the tests do their own setup so that they\nare not dependent on the success of the previous test.\nThe end result is shorter tests and better test isolation.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nWe no longer export variables into the environment per Jonathan's\nsuggestion.  This covers all of the review notes.\n\n t/t7800-difftool.sh | 360 ++++++++++++++++++++++++----------------------------\n 1 file changed, 165 insertions(+), 195 deletions(-)\n\ndiff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh\nindex 5b5939b..b577c01 100755\n--- a/t/t7800-difftool.sh\n+++ b/t/t7800-difftool.sh\n@@ -10,29 +10,11 @@ Testing basic diff tool invocation\n \n . ./test-lib.sh\n \n-remove_config_vars()\n+difftool_test_setup()\n {\n-\t# Unset all config variables used by git-difftool\n-\tgit config --unset diff.tool\n-\tgit config --unset diff.guitool\n-\tgit config --unset difftool.test-tool.cmd\n-\tgit config --unset difftool.prompt\n-\tgit config --unset merge.tool\n-\tgit config --unset mergetool.test-tool.cmd\n-\tgit config --unset mergetool.prompt\n-\treturn 0\n-}\n-\n-restore_test_defaults()\n-{\n-\t# Restores the test defaults used by several tests\n-\tremove_config_vars\n-\tunset GIT_DIFF_TOOL\n-\tunset GIT_DIFFTOOL_PROMPT\n-\tunset GIT_DIFFTOOL_NO_PROMPT\n-\tgit config diff.tool test-tool &&\n-\tgit config difftool.test-tool.cmd 'cat $LOCAL'\n-\tgit config difftool.bogus-tool.cmd false\n+\ttest_config diff.tool test-tool &&\n+\ttest_config difftool.test-tool.cmd 'cat $LOCAL' &&\n+\ttest_config difftool.bogus-tool.cmd false\n }\n \n prompt_given()\n@@ -65,249 +47,237 @@ test_expect_success PERL 'setup' '\n \n # Configure a custom difftool.<tool>.cmd and use it\n test_expect_success PERL 'custom commands' '\n-\trestore_test_defaults &&\n-\tgit config difftool.test-tool.cmd \"cat \\$REMOTE\" &&\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-\tdiff=$(git difftool --no-prompt branch) &&\n-\ttest \"$diff\" = \"master\" &&\n-\n-\trestore_test_defaults &&\n-\tdiff=$(git difftool --no-prompt branch) &&\n-\ttest \"$diff\" = \"branch\"\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 '\n \n-# Ensures that a custom difftool.<tool>.cmd overrides built-ins\n-test_expect_success PERL 'custom commands override built-ins' '\n-\trestore_test_defaults &&\n-\tgit config difftool.defaults.cmd \"cat \\$REMOTE\" &&\n-\n-\tdiff=$(git difftool --tool defaults --no-prompt branch) &&\n-\ttest \"$diff\" = \"master\" &&\n-\n-\tgit config --unset difftool.defaults.cmd\n+test_expect_success PERL 'custom tool commands override built-ins' '\n+\ttest_config difftool.defaults.cmd \"cat \\$REMOTE\" &&\n+\techo master >expect &&\n+\tgit difftool --tool defaults --no-prompt branch >actual &&\n+\ttest_cmp expect actual\n '\n \n-# Ensures that git-difftool ignores bogus --tool values\n test_expect_success PERL 'difftool ignores bad --tool values' '\n-\tdiff=$(git difftool --no-prompt --tool=bad-tool branch)\n-\ttest \"$?\" = 1 &&\n-\ttest \"$diff\" = \"\"\n+\t: >expect &&\n+\ttest_expect_code 1 \\\n+\t\tgit difftool --no-prompt --tool=bad-tool branch >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success PERL 'difftool forwards arguments to diff' '\n+\tdifftool_test_setup &&\n \t>for-diff &&\n \tgit add for-diff &&\n \techo changes>for-diff &&\n \tgit add for-diff &&\n-\tdiff=$(git difftool --cached --no-prompt -- for-diff) &&\n-\ttest \"$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 '\n \n test_expect_success PERL 'difftool honors --gui' '\n-\tgit config merge.tool bogus-tool &&\n-\tgit config diff.tool bogus-tool &&\n-\tgit config diff.guitool test-tool &&\n-\n-\tdiff=$(git difftool --no-prompt --gui branch) &&\n-\ttest \"$diff\" = \"branch\" &&\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-\trestore_test_defaults\n+\techo branch >expect &&\n+\tgit difftool --no-prompt --gui branch >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success PERL 'difftool --gui last setting wins' '\n-\tgit config diff.guitool bogus-tool &&\n-\tgit difftool --no-prompt --gui --no-gui &&\n+\tdifftool_test_setup &&\n+\t: >expect &&\n+\tgit difftool --no-prompt --gui --no-gui >actual &&\n+\ttest_cmp expect actual &&\n \n-\tgit config merge.tool bogus-tool &&\n-\tgit config diff.tool bogus-tool &&\n-\tgit config diff.guitool test-tool &&\n-\tdiff=$(git difftool --no-prompt --no-gui --gui branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n-\n-\trestore_test_defaults\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 '\n \n test_expect_success PERL 'difftool --gui works without configured diff.guitool' '\n-\tgit config diff.tool test-tool &&\n-\n-\tdiff=$(git difftool --no-prompt --gui branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n-\n-\trestore_test_defaults\n+\tdifftool_test_setup &&\n+\techo branch >expect &&\n+\tgit difftool --no-prompt --gui branch >actual &&\n+\ttest_cmp expect actual\n '\n \n # Specify the diff tool using $GIT_DIFF_TOOL\n test_expect_success PERL 'GIT_DIFF_TOOL variable' '\n-\ttest_might_fail git config --unset diff.tool &&\n-\tGIT_DIFF_TOOL=test-tool &&\n-\texport GIT_DIFF_TOOL &&\n-\n-\tdiff=$(git difftool --no-prompt branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n-\n-\trestore_test_defaults\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 '\n \n # Test the $GIT_*_TOOL variables and ensure\n # that $GIT_DIFF_TOOL always wins unless --tool is specified\n test_expect_success PERL 'GIT_DIFF_TOOL overrides' '\n-\tgit config diff.tool bogus-tool &&\n-\tgit config merge.tool bogus-tool &&\n-\n-\tGIT_DIFF_TOOL=test-tool &&\n-\texport GIT_DIFF_TOOL &&\n-\n-\tdiff=$(git difftool --no-prompt branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n+\tdifftool_test_setup &&\n+\ttest_config diff.tool bogus-tool &&\n+\ttest_config merge.tool bogus-tool &&\n \n-\tGIT_DIFF_TOOL=bogus-tool &&\n-\texport GIT_DIFF_TOOL &&\n+\techo branch >expect &&\n+\tGIT_DIFF_TOOL=test-tool git difftool --no-prompt branch >actual &&\n+\ttest_cmp expect actual &&\n \n-\tdiff=$(git difftool --no-prompt --tool=test-tool branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n-\n-\trestore_test_defaults\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 '\n \n # Test that we don't have to pass --no-prompt to difftool\n # when $GIT_DIFFTOOL_NO_PROMPT is true\n test_expect_success PERL 'GIT_DIFFTOOL_NO_PROMPT variable' '\n-\tGIT_DIFFTOOL_NO_PROMPT=true &&\n-\texport GIT_DIFFTOOL_NO_PROMPT &&\n-\n-\tdiff=$(git difftool branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n-\n-\trestore_test_defaults\n+\tdifftool_test_setup &&\n+\techo branch >expect &&\n+\tGIT_DIFFTOOL_NO_PROMPT=true git difftool branch >actual &&\n+\ttest_cmp expect actual\n '\n \n # git-difftool supports the difftool.prompt variable.\n # Test that GIT_DIFFTOOL_PROMPT can override difftool.prompt = false\n test_expect_success PERL 'GIT_DIFFTOOL_PROMPT variable' '\n-\tgit config difftool.prompt false &&\n-\tGIT_DIFFTOOL_PROMPT=true &&\n-\texport GIT_DIFFTOOL_PROMPT &&\n-\n-\tprompt=$(echo | git difftool branch | tail -1) &&\n-\tprompt_given \"$prompt\" &&\n-\n-\trestore_test_defaults\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 '\n \n # Test that we don't have to pass --no-prompt when difftool.prompt is false\n test_expect_success PERL 'difftool.prompt config variable is false' '\n-\tgit config difftool.prompt false &&\n-\n-\tdiff=$(git difftool branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n-\n-\trestore_test_defaults\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 '\n \n # Test that we don't have to pass --no-prompt when mergetool.prompt is false\n test_expect_success PERL 'difftool merge.prompt = false' '\n+\tdifftool_test_setup &&\n \ttest_might_fail git config --unset difftool.prompt &&\n-\tgit config mergetool.prompt false &&\n-\n-\tdiff=$(git difftool branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n-\n-\trestore_test_defaults\n+\ttest_config mergetool.prompt false &&\n+\techo branch >expect &&\n+\tgit difftool branch >actual &&\n+\ttest_cmp expect actual\n '\n \n # Test that the -y flag can override difftool.prompt = true\n test_expect_success PERL 'difftool.prompt can overridden with -y' '\n-\tgit config difftool.prompt true &&\n-\n-\tdiff=$(git difftool -y branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n-\n-\trestore_test_defaults\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 '\n \n # Test that the --prompt flag can override difftool.prompt = false\n test_expect_success PERL 'difftool.prompt can overridden with --prompt' '\n-\tgit config difftool.prompt false &&\n-\n-\tprompt=$(echo | git difftool --prompt branch | tail -1) &&\n-\tprompt_given \"$prompt\" &&\n-\n-\trestore_test_defaults\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 '\n \n # Test that the last flag passed on the command-line wins\n test_expect_success PERL 'difftool last flag wins' '\n-\tdiff=$(git difftool --prompt --no-prompt branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n-\n-\trestore_test_defaults &&\n-\n-\tprompt=$(echo | git difftool --no-prompt --prompt branch | tail -1) &&\n-\tprompt_given \"$prompt\" &&\n-\n-\trestore_test_defaults\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 '\n \n # git-difftool falls back to git-mergetool config variables\n # so test that behavior here\n test_expect_success PERL 'difftool + mergetool config variables' '\n-\tremove_config_vars &&\n-\tgit config merge.tool test-tool &&\n-\tgit config mergetool.test-tool.cmd \"cat \\$LOCAL\" &&\n-\n-\tdiff=$(git difftool --no-prompt branch) &&\n-\ttest \"$diff\" = \"branch\" &&\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-\tgit config merge.tool bogus-tool &&\n-\tgit config diff.tool test-tool &&\n-\n-\tdiff=$(git difftool --no-prompt branch) &&\n-\ttest \"$diff\" = \"branch\" &&\n-\n-\trestore_test_defaults\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 '\n \n test_expect_success PERL 'difftool.<tool>.path' '\n-\tgit config difftool.tkdiff.path echo &&\n-\tdiff=$(git difftool --tool=tkdiff --no-prompt branch) &&\n-\tgit config --unset difftool.tkdiff.path &&\n-\tlines=$(echo \"$diff\" | grep file | wc -l) &&\n-\ttest \"$lines\" -eq 1 &&\n-\n-\trestore_test_defaults\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 '\n \n test_expect_success PERL 'difftool --extcmd=cat' '\n-\tdiff=$(git difftool --no-prompt --extcmd=cat branch) &&\n-\ttest \"$diff\" = branch\"$LF\"master\n+\techo branch >expect &&\n+\techo master >>expect &&\n+\tgit difftool --no-prompt --extcmd=cat branch >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success PERL 'difftool --extcmd cat' '\n-\tdiff=$(git difftool --no-prompt --extcmd cat branch) &&\n-\ttest \"$diff\" = branch\"$LF\"master\n+\techo branch >expect &&\n+\techo master >>expect &&\n+\tgit difftool --no-prompt --extcmd=cat branch >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success PERL 'difftool -x cat' '\n-\tdiff=$(git difftool --no-prompt -x cat branch) &&\n-\ttest \"$diff\" = branch\"$LF\"master\n+\techo branch >expect &&\n+\techo master >>expect &&\n+\tgit difftool --no-prompt -x cat branch >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success PERL 'difftool --extcmd echo arg1' '\n-\tdiff=$(git difftool --no-prompt --extcmd sh\\ -c\\ \\\"echo\\ \\$1\\\" branch) &&\n-\ttest \"$diff\" = file\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 '\n \n test_expect_success PERL 'difftool --extcmd cat arg1' '\n-\tdiff=$(git difftool --no-prompt --extcmd sh\\ -c\\ \\\"cat\\ \\$1\\\" branch) &&\n-\ttest \"$diff\" = master\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 '\n \n test_expect_success PERL 'difftool --extcmd cat arg2' '\n-\tdiff=$(git difftool --no-prompt --extcmd sh\\ -c\\ \\\"cat\\ \\$2\\\" branch) &&\n-\ttest \"$diff\" = branch\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 '\n \n # Create a second file on master and a different version on branch\n@@ -324,26 +294,26 @@ test_expect_success PERL 'setup with 2 files different' '\n '\n \n test_expect_success PERL 'say no to the first file' '\n-\tdiff=$( (echo n; echo) | git difftool -x cat branch ) &&\n-\n-\techo \"$diff\" | stdin_contains m2 &&\n-\techo \"$diff\" | stdin_contains br2 &&\n-\techo \"$diff\" | stdin_doesnot_contain master &&\n-\techo \"$diff\" | stdin_doesnot_contain branch\n+\t(echo n && echo) >input &&\n+\tgit difftool -x cat branch <input >output &&\n+\tcat output | stdin_contains m2 &&\n+\tcat output | stdin_contains br2 &&\n+\tcat output | stdin_doesnot_contain master &&\n+\tcat output | stdin_doesnot_contain branch\n '\n \n test_expect_success PERL 'say no to the second file' '\n-\tdiff=$( (echo; echo n) | git difftool -x cat branch ) &&\n-\n-\techo \"$diff\" | stdin_contains master &&\n-\techo \"$diff\" | stdin_contains branch &&\n-\techo \"$diff\" | stdin_doesnot_contain m2 &&\n-\techo \"$diff\" | stdin_doesnot_contain br2\n+\t(echo && echo n) >input &&\n+\tgit difftool -x cat branch <input >output &&\n+\tcat output | stdin_contains master &&\n+\tcat output | stdin_contains branch &&\n+\tcat output | stdin_doesnot_contain m2 &&\n+\tcat output | stdin_doesnot_contain br2\n '\n \n test_expect_success PERL 'difftool --tool-help' '\n-\ttool_help=$(git difftool --tool-help) &&\n-\techo \"$tool_help\" | stdin_contains tool\n+\tgit difftool --tool-help >output &&\n+\tcat output | stdin_contains tool\n '\n \n test_expect_success PERL 'setup change in subdirectory' '\n@@ -359,29 +329,29 @@ test_expect_success PERL 'setup change in subdirectory' '\n '\n \n test_expect_success PERL 'difftool -d' '\n-\tdiff=$(git difftool -d --extcmd ls branch) &&\n-\techo \"$diff\" | stdin_contains sub &&\n-\techo \"$diff\" | stdin_contains file\n+\tgit difftool -d --extcmd ls branch >output &&\n+\tcat output | stdin_contains sub &&\n+\tcat output | stdin_contains file\n '\n \n test_expect_success PERL 'difftool --dir-diff' '\n-\tdiff=$(git difftool --dir-diff --extcmd ls branch) &&\n-\techo \"$diff\" | stdin_contains sub &&\n-\techo \"$diff\" | stdin_contains file\n+\tgit difftool --dir-diff --extcmd ls branch >output &&\n+\tcat output | stdin_contains sub &&\n+\tcat output | stdin_contains file\n '\n \n test_expect_success PERL 'difftool --dir-diff ignores --prompt' '\n-\tdiff=$(git difftool --dir-diff --prompt --extcmd ls branch) &&\n-\techo \"$diff\" | stdin_contains sub &&\n-\techo \"$diff\" | stdin_contains file\n+\tgit difftool --dir-diff --prompt --extcmd ls branch >output &&\n+\tcat output | stdin_contains sub &&\n+\tcat output | stdin_contains file\n '\n \n test_expect_success PERL 'difftool --dir-diff from subdirectory' '\n \t(\n \t\tcd sub &&\n-\t\tdiff=$(git difftool --dir-diff --extcmd ls branch) &&\n-\t\techo \"$diff\" | stdin_contains sub &&\n-\t\techo \"$diff\" | stdin_contains file\n+\t\tgit difftool --dir-diff --extcmd ls branch >output &&\n+\t\tcat output | stdin_contains sub &&\n+\t\tcat output | stdin_contains file\n \t)\n '\n \n-- \n1.8.2.rc0.20.gf548dd7\n"},{"id":"209883","messageId":"1361338528-17835-4-git-send-email-davvid@gmail.com","threadId":"32947","inReplyTo":"1361338528-17835-3-git-send-email-davvid@gmail.com","subject":"[PATCH v2 4/4] t7800: \"defaults\" is no longer a builtin tool name","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-02-20T05:35:28Z","receivedAt":"2013-02-20T05:35:28Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"073678b8e6324a155fa99f40eee0637941a70a34 reworked the\nmergetools/ directory so that every file corresponds to a\ndifftool-supported tool.  When this happened the \"defaults\"\nfile went away as it was no longer needed by mergetool--lib.\n\nt7800 tests that configured commands can override builtins,\nbut this test was not adjusted when the \"defaults\" file was\nremoved because the test continued to pass.\n\nAdjust the test to use the everlasting \"vimdiff\" tool name\ninstead of \"defaults\" so that it correctly tests against a tool\nthat is known by mergetool--lib.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nRebased for the new parent patch.\n\n t/t7800-difftool.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh\nindex b577c01..18df2c8 100755\n--- a/t/t7800-difftool.sh\n+++ b/t/t7800-difftool.sh\n@@ -60,9 +60,9 @@ test_expect_success PERL 'custom commands' '\n '\n \n test_expect_success PERL 'custom tool commands override built-ins' '\n-\ttest_config difftool.defaults.cmd \"cat \\$REMOTE\" &&\n+\ttest_config difftool.vimdiff.cmd \"cat \\$REMOTE\" &&\n \techo master >expect &&\n-\tgit difftool --tool defaults --no-prompt branch >actual &&\n+\tgit difftool --tool vimdiff --no-prompt branch >actual &&\n \ttest_cmp expect actual\n '\n \n-- \n1.8.2.rc0.20.gf548dd7\n"},{"id":"209889","messageId":"7vip5nzcqf.fsf@alter.siamese.dyndns.org","threadId":"32947","inReplyTo":"1361338528-17835-3-git-send-email-davvid@gmail.com","subject":"Re: [PATCH v2 3/4] t7800: modernize tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-20T07:05:44Z","receivedAt":"2013-02-20T07:05:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n> Eliminate a lot of redundant work by using test_config().\n> Catch more return codes by more use of temporary files\n> and test_cmp.\n>\n> The original tests relied upon restore_test_defaults()\n> from the previous test to provide the next test with a sane\n> environment.  Make the tests do their own setup so that they\n> are not dependent on the success of the previous test.\n> The end result is shorter tests and better test isolation.\n>\n> Signed-off-by: David Aguilar <davvid@gmail.com>\n> ---\n> We no longer export variables into the environment per Jonathan's\n> suggestion.  This covers all of the review notes.\n>\n>  t/t7800-difftool.sh | 360 ++++++++++++++++++++++++----------------------------\n>  1 file changed, 165 insertions(+), 195 deletions(-)\n>\n> diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh\n> index 5b5939b..b577c01 100755\n> --- a/t/t7800-difftool.sh\n> +++ b/t/t7800-difftool.sh\n> @@ -10,29 +10,11 @@ Testing basic diff tool invocation\n>  \n>  . ./test-lib.sh\n>  \n> +difftool_test_setup()\n>  {\n> +\ttest_config diff.tool test-tool &&\n> +\ttest_config difftool.test-tool.cmd 'cat $LOCAL' &&\n> +\ttest_config difftool.bogus-tool.cmd false\n>  }\n\nCute.\n\nAre we sure that $LOCAL is free of $IFS, or is it safer to say 'cat\n\"$LOCAL\"' or something?\n\n> @@ -324,26 +294,26 @@ test_expect_success PERL 'setup with 2 files different' '\n>  '\n>  \n>  test_expect_success PERL 'say no to the first file' '\n> -\tdiff=$( (echo n; echo) | git difftool -x cat branch ) &&\n> -\n> -\techo \"$diff\" | stdin_contains m2 &&\n> -\techo \"$diff\" | stdin_contains br2 &&\n> -\techo \"$diff\" | stdin_doesnot_contain master &&\n> -\techo \"$diff\" | stdin_doesnot_contain branch\n> +\t(echo n && echo) >input &&\n> +\tgit difftool -x cat branch <input >output &&\n> +\tcat output | stdin_contains m2 &&\n> +\tcat output | stdin_contains br2 &&\n> +\tcat output | stdin_doesnot_contain master &&\n> +\tcat output | stdin_doesnot_contain branch\n\nDo you need these pipes?  In other words, wouldn't\n\n\tstdin_contains whatever <output\n\nbe more straight-forward way to say these?\n"}]}