t9001: drop save_confirm helper

The idea of this helper is that we want to save the current value of a config variable and then restore it again after the test completes. However, there's no point in actually saving the value; it should always be restored to the string "never" (which you can confirm by instrumenting save_confirm to print the value it finds). Let's just replace it with a single test_when_finished call. Suggested-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Mar 25, 2015 at 01:32 UTC fc99da1fb7eebae0ccca7709b5fa3e55178d8434
1 file changed +5 -10
t/t9001-send-email.sh
+5 -10
@@ -817,25 +817,20 @@ test_expect_success $PREREQ '--confirm=compose' '
817 test_confirm --confirm=compose --compose
818 '
819
820 -save_confirm () {
821 - CONFIRM=$(git config --get sendemail.confirm) &&
822 - test_when_finished "git config sendemail.confirm ${CONFIRM:-never}"
823 -}
824 -
820 test_expect_success $PREREQ 'confirm by default (due to cc)' '
826 - save_confirm &&
821 + test_when_finished git config sendemail.confirm never &&
822 git config --unset sendemail.confirm &&
823 test_confirm
824 '
825
826 test_expect_success $PREREQ 'confirm by default (due to --compose)' '
832 - save_confirm &&
827 + test_when_finished git config sendemail.confirm never &&
828 git config --unset sendemail.confirm &&
829 test_confirm --suppress-cc=all --compose
830 '
831
832 test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' '
838 - save_confirm &&
833 + test_when_finished git config sendemail.confirm never &&
834 git config --unset sendemail.confirm &&
835 rm -fr outdir &&
836 git format-patch -2 -o outdir &&
@@ -848,7 +843,7 @@ test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' '
843 '
844
845 test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' '
851 - save_confirm &&
846 + test_when_finished git config sendemail.confirm never &&
847 git config sendemail.confirm auto &&
848 GIT_SEND_EMAIL_NOTTY=1 &&
849 export GIT_SEND_EMAIL_NOTTY &&
@@ -860,7 +855,7 @@ test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' '
855 '
856
857 test_expect_success $PREREQ 'confirm does not loop forever' '
863 - save_confirm &&
858 + test_when_finished git config sendemail.confirm never &&
859 git config sendemail.confirm auto &&
860 GIT_SEND_EMAIL_NOTTY=1 &&
861 export GIT_SEND_EMAIL_NOTTY &&