From a97dd7ffa8c47e365fbaf40d2b5a2180649680f5 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sat, 2 Apr 2022 18:01:15 +0300 Subject: [PATCH] `SECRETS_TEST_VERBOSE` can be `0` (#816) * `SECRETS_TEST_VERBOSE` can be `0` * Update _git_secret_tools.sh --- src/_utils/_git_secret_tools.sh | 2 +- tests/_test_base.bash | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/_utils/_git_secret_tools.sh b/src/_utils/_git_secret_tools.sh index 466ab35c..862835e7 100644 --- a/src/_utils/_git_secret_tools.sh +++ b/src/_utils/_git_secret_tools.sh @@ -190,7 +190,7 @@ function _temporary_file { # which will be removed on system exit. temporary_filename=$(_os_based __temp_file) # is not `local` on purpose. - trap 'if [[ -f "$temporary_filename" ]]; then if [[ -n "$_SECRETS_VERBOSE" ]] || [[ -n "$SECRETS_TEST_VERBOSE" ]]; then echo "git-secret: cleaning up: $temporary_filename"; fi; rm -f "$temporary_filename"; fi;' EXIT + trap 'if [[ -f "$temporary_filename" ]]; then if [[ -n "$_SECRETS_VERBOSE" ]] || [[ "$SECRETS_TEST_VERBOSE" == 1 ]]; then echo "git-secret: cleaning up: $temporary_filename"; fi; rm -f "$temporary_filename"; fi;' EXIT } diff --git a/tests/_test_base.bash b/tests/_test_base.bash index 27e0f9ad..c29610aa 100644 --- a/tests/_test_base.bash +++ b/tests/_test_base.bash @@ -324,7 +324,7 @@ function unset_current_state { stop_gpg_agent # SECRETS_TEST_VERBOSE is experimental - if [[ -n "$SECRETS_TEST_VERBOSE" ]]; then + if [[ "$SECRETS_TEST_VERBOSE" == 1 ]]; then # display the captured output as bats diagnostic (fd3, preceded by '# ') sed "s/^/# $BATS_TEST_DESCRIPTION: VERBOSE OUTPUT: /" < "$TEST_OUTPUT_FILE" >&3 @@ -352,7 +352,7 @@ function unset_current_state { } # show output if we wind up manually removing the test output file in a trap -trap 'if [[ -f "$TEST_OUTPUT_FILE" ]]; then if [[ -n "$SECRETS_TEST_VERBOSE" ]]; then echo "git-secret: test: cleaning up: $TEST_OUTPUT_FILE"; fi; rm -f "$TEST_OUTPUT_FILE"; fi;' EXIT +trap 'if [[ -f "$TEST_OUTPUT_FILE" ]]; then if [[ "$SECRETS_TEST_VERBOSE" == 1 ]]; then echo "git-secret: test: cleaning up: $TEST_OUTPUT_FILE"; fi; rm -f "$TEST_OUTPUT_FILE"; fi;' EXIT function bats_diag_file { local filename=$1