diff --git a/src/_utils/_git_secret_tools.sh b/src/_utils/_git_secret_tools.sh index a362b0db..d1b26282 100644 --- a/src/_utils/_git_secret_tools.sh +++ b/src/_utils/_git_secret_tools.sh @@ -777,6 +777,7 @@ function _decrypt { if [ ! -f "$encrypted_filename" ]; then _warn_or_abort "cannot find file to decrypt: $encrypted_filename" "1" "$error_ok" else + # we no longer use --no-permission-warning on decryption, for #811 local args=( "--use-agent" "--decrypt" ) if [[ "$write_to_file" -eq 1 ]]; then @@ -798,12 +799,11 @@ function _decrypt { args+=( "--pinentry-mode" "loopback" ) fi fi - + if [[ -z "$_SECRETS_VERBOSE" ]]; then - # we no longer use --no-permission-warning here, for #811 args+=( "--quiet" ) fi - + set +e # disable 'set -e' so we can capture exit_code #echo "# gpg passphrase: $passphrase" >&3 diff --git a/src/commands/git_secret_hide.sh b/src/commands/git_secret_hide.sh index 7236be73..f481d412 100644 --- a/src/commands/git_secret_hide.sh +++ b/src/commands/git_secret_hide.sh @@ -109,6 +109,7 @@ function hide { # If -c option was provided, clean the hidden files # before creating new ones. + # BUG: if passed files, we should only delete them, but we always delete all secret files; see issue #834 if [[ $clean -eq 1 ]]; then _find_and_remove_secrets_formatted fi @@ -169,6 +170,10 @@ function hide { args+=( '--armor' ) fi + if [[ -n "$_SECRETS_VERBOSE" ]]; then + args+=( '--verbose' ) + fi + # we depend on $recipients being split on whitespace # shellcheck disable=SC2206 args+=( $recipients -o "$output_path" "$input_path" ) diff --git a/tests/test_cat.bats b/tests/test_cat.bats index e88b6739..64e19472 100644 --- a/tests/test_cat.bats +++ b/tests/test_cat.bats @@ -53,7 +53,7 @@ function teardown { } -@test "run 'cat' with wrong filename" { +@test "run 'cat' with bad filename" { run git secret cat -d "$TEST_GPG_HOMEDIR" -p "$password" NO_SUCH_FILE [ "$status" -eq 1 ] } diff --git a/tests/test_reveal.bats b/tests/test_reveal.bats index 5799743a..4a6cfdc0 100644 --- a/tests/test_reveal.bats +++ b/tests/test_reveal.bats @@ -46,15 +46,11 @@ function teardown { @test "run 'reveal' with bad arg" { - cp "$FILE_TO_HIDE" "${FILE_TO_HIDE}2" - rm -f "$FILE_TO_HIDE" - local password=$(test_user_password "$TEST_DEFAULT_USER") run git secret reveal -Z -d "$TEST_GPG_HOMEDIR" -p "$password" [ "$status" -ne 0 ] } - @test "run 'reveal' on secret version of file" { local password=$(test_user_password "$TEST_DEFAULT_USER") run git secret reveal -d "$TEST_GPG_HOMEDIR" -p "$password" "$FILE_TO_HIDE$SECRETS_EXTENSION"