Varnames output and typos (#441)

* rename variable, fix typo, improve comments and output
* fix directory removal after testing
* mention improved user messaging in CHANGELOG.md
pull/445/head^2
Josh Rabinowitz 5 years ago committed by GitHub
parent be88da4c0c
commit 07af0c19b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
.gitignore vendored

@ -133,6 +133,6 @@ build/
*.deb
*.fpm
# Kithcne files
# Kitchen files
Gemfile.lock
.kitchen/

@ -38,6 +38,7 @@
- Update CHANGELOG.md to mention fix for #281 in v0.2.5 (#311)
- Add text explaining git-secret Style Guide and Development Philosophy
- Upgrade bats-core to v1.1.0, import bats-core into vendor/bats-core (#377)
- Improve git-secret user messaging.
## Version 0.2.5

@ -189,14 +189,14 @@ function _file_has_line {
# this sets the global variable 'filename'
# this sets the global variable 'temporary_filename'
# currently this function is only used by 'hide'
function _temporary_file {
# This function creates temporary file
# which will be removed on system exit.
filename=$(_os_based __temp_file) # is not `local` on purpose.
temporary_filename=$(_os_based __temp_file) # is not `local` on purpose.
trap 'echo "git-secret: cleaning up..."; rm -f "$filename";' EXIT
trap 'echo "git-secret: cleaning up: $temporary_filename"; rm -f "$temporary_filename";' EXIT
}
@ -210,8 +210,8 @@ function _gawk_inplace {
_temporary_file
bash -c "gawk ${parms}" > "$filename"
mv "$filename" "$dest_file"
bash -c "gawk ${parms}" > "$temporary_filename"
mv "$temporary_filename" "$dest_file"
}
@ -476,7 +476,7 @@ function _find_and_clean_formatted {
local pattern="$1" # can be any string pattern
if [[ -n "$_SECRETS_VERBOSE" ]]; then
echo && echo "git-secret: cleaning:"
echo && _message "cleaning:"
fi
_find_and_clean "$pattern"

@ -69,7 +69,7 @@ function init {
mkdir "$git_secret_dir" "$(_get_secrets_dir_keys)" "$(_get_secrets_dir_path)"
touch "$(_get_secrets_dir_keys_mapping)" "$(_get_secrets_dir_paths_mapping)"
_message "'$git_secret_dir/' created."
_message "init created: '$git_secret_dir/'"
local random_seed_file
random_seed_file="${_SECRETS_DIR}/keys/random_seed"

@ -72,9 +72,9 @@ function tell {
start_key_cnt=$(get_gpg_key_count)
for email in "${emails[@]}"; do
# This file will be removed automatically:
_temporary_file # note, that `_temporary_file` will export `filename` var.
_temporary_file # note that `_temporary_file` will export `temporary_filename` var.
# shellcheck disable=2154
local keyfile="$filename"
local keyfile="$temporary_filename"
local exit_code
if [[ -z "$homedir" ]]; then

@ -146,7 +146,7 @@ function teardown {
# git secret hide -m, use temp file so cleaning should take place
[[ "${#lines[@]}" -eq 2 ]]
[ "${lines[0]}" = "git-secret: done. 1 of 1 files are hidden." ]
[ "${lines[1]}" = "git-secret: cleaning up..." ]
[[ "${lines[1]}" == "git-secret: cleaning up:"* ]]
# New files should be created:
local encrypted_file=$(_get_encrypted_filename "$FILE_TO_HIDE")
@ -166,7 +166,7 @@ function teardown {
# git secret hide -m, uses a temp file so cleaning should take place
[[ "${#lines[@]}" -eq 2 ]]
[ "${lines[0]}" = "git-secret: done. 1 of 1 files are hidden." ]
[ "${lines[1]}" = "git-secret: cleaning up..." ]
[[ "${lines[1]}" == "git-secret: cleaning up:"* ]]
# back path mappings
cp "${path_mappings}" "${path_mappings}.bak"
# run hide again

@ -36,9 +36,7 @@ function teardown {
# We will break things apart, so normally it won't run:
rm -r "./.git"
# This must fail:
run git secret usage
[ "$status" -eq 1 ]
# test of 'git secret usage' here removed as it's duplicated in test_usage.bats
# Dry run won't fail:
run git secret --dry-run

@ -20,9 +20,10 @@ function teardown {
}
@test "run 'usage' without '.git/'" {
@test "run 'usage' without '.git'" {
remove_git_repository
# It's ok for 'usage' to succeed when there's no .git directory, but it doesn't
run git secret usage
[ "$status" -eq 1 ]
}
@ -36,6 +37,7 @@ function teardown {
#echo "# clear-line-output" >&3
#echo "# SECRETS_DIR is ${_SECRETS_DIR}" >&3
# It's ok for 'usage' to succeed when the .gitsecret directory is ignored, but it doesn't
run git secret usage
#echo "# git secret usage -> status $status" >&3

@ -16,4 +16,4 @@ export SECRETS_EXTENSION=.secret2
# bats ... 3>&1 shows diagnostic output when errors occur.
bats "${SECRET_PROJECT_ROOT}/tests/" 3>&1
rm -rf 'tempdir with spaces'
cd ..; rm -rf 'tempdir with spaces'

Loading…
Cancel
Save