diff options
author | Jeff King <peff@peff.net> | 2015-03-25 01:32:20 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-25 12:49:33 -0700 |
commit | fc99da1fb7eebae0ccca7709b5fa3e55178d8434 (patch) | |
tree | 1bf39c1a86e3b4a0a25b3a08e9ce4515b81d5a9a | |
parent | t0020: use test_* helpers instead of hand-rolled messages (diff) | |
download | tgif-fc99da1fb7eebae0ccca7709b5fa3e55178d8434.tar.xz |
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>
-rwxr-xr-x | t/t9001-send-email.sh | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index c9f54d5a5e..7be14a4e37 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -817,25 +817,20 @@ test_expect_success $PREREQ '--confirm=compose' ' test_confirm --confirm=compose --compose ' -save_confirm () { - CONFIRM=$(git config --get sendemail.confirm) && - test_when_finished "git config sendemail.confirm ${CONFIRM:-never}" -} - test_expect_success $PREREQ 'confirm by default (due to cc)' ' - save_confirm && + test_when_finished git config sendemail.confirm never && git config --unset sendemail.confirm && test_confirm ' test_expect_success $PREREQ 'confirm by default (due to --compose)' ' - save_confirm && + test_when_finished git config sendemail.confirm never && git config --unset sendemail.confirm && test_confirm --suppress-cc=all --compose ' test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' ' - save_confirm && + test_when_finished git config sendemail.confirm never && git config --unset sendemail.confirm && rm -fr outdir && git format-patch -2 -o outdir && @@ -848,7 +843,7 @@ test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' ' ' test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' ' - save_confirm && + test_when_finished git config sendemail.confirm never && git config sendemail.confirm auto && GIT_SEND_EMAIL_NOTTY=1 && export GIT_SEND_EMAIL_NOTTY && @@ -860,7 +855,7 @@ test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' ' ' test_expect_success $PREREQ 'confirm does not loop forever' ' - save_confirm && + test_when_finished git config sendemail.confirm never && git config sendemail.confirm auto && GIT_SEND_EMAIL_NOTTY=1 && export GIT_SEND_EMAIL_NOTTY && |