diff --git a/src/_utils/_git_secret_tools.sh b/src/_utils/_git_secret_tools.sh index 1e1a38b2..c4f91f4c 100644 --- a/src/_utils/_git_secret_tools.sh +++ b/src/_utils/_git_secret_tools.sh @@ -424,7 +424,7 @@ function _get_gpg_local { function _abort { local message="$1" # required - >&2 echo "$message abort." + >&2 echo "git-secret: abort: $message" exit 1 } @@ -484,7 +484,9 @@ function _secrets_dir_exists { full_path=$(_get_secrets_dir) if [[ ! -d "$full_path" ]]; then - _abort "$full_path does not exist." + local name + name=$(basename "$full_path") + _abort "directory '$name' does not exist. Use 'git secret init' to initialize git-secret" fi } @@ -508,7 +510,7 @@ function _secrets_dir_is_not_ignored { fi if [[ ! $ignores -eq 1 ]]; then - _abort "'$git_secret_dir' is ignored." + _abort "'$git_secret_dir' is in .gitignore" fi } diff --git a/src/commands/git_secret_add.sh b/src/commands/git_secret_add.sh index 8e2476fe..450b697a 100644 --- a/src/commands/git_secret_add.sh +++ b/src/commands/git_secret_add.sh @@ -52,7 +52,7 @@ function add { if [[ ! "${#not_ignored[@]}" -eq 0 ]]; then # And show them all at once. local message - message="these files are not ignored: $* ;" + message="these files are not in .gitignore: $* ;" if [[ "$auto_ignore" -eq 0 ]]; then # This file is not ignored. user don't want it to be added automatically. diff --git a/src/commands/git_secret_killperson.sh b/src/commands/git_secret_killperson.sh index f27dcd33..0d637583 100644 --- a/src/commands/git_secret_killperson.sh +++ b/src/commands/git_secret_killperson.sh @@ -22,7 +22,7 @@ function killperson { local emails=( "$@" ) if [[ ${#emails[@]} -eq 0 ]]; then - _abort "at least one email is required." + _abort "at least one email is required for killperson." fi # Getting the local `gpg` command: diff --git a/src/commands/git_secret_remove.sh b/src/commands/git_secret_remove.sh index 94fc8791..8eada67f 100644 --- a/src/commands/git_secret_remove.sh +++ b/src/commands/git_secret_remove.sh @@ -37,7 +37,7 @@ function remove { # Checking if file exists: if [[ ! -f "$path" ]]; then - _abort "$item is not a file." + _abort "not a file: $item" fi # Deleting it from path mappings: diff --git a/src/commands/git_secret_tell.sh b/src/commands/git_secret_tell.sh index 0dd11b04..bb0e5db1 100644 --- a/src/commands/git_secret_tell.sh +++ b/src/commands/git_secret_tell.sh @@ -77,7 +77,7 @@ function tell { fi if [[ ! -s "$keyfile" ]]; then - _abort 'gpg key is empty. check your key name: "gpg --list-keys".' + _abort "no keyfile found for '$email'. Check your key name: 'gpg --list-keys'." fi # Importing public key to the local keychain: diff --git a/src/main.sh b/src/main.sh index f4f52eaf..2277d1d1 100755 --- a/src/main.sh +++ b/src/main.sh @@ -7,7 +7,7 @@ function _check_setup { local is_tree is_tree=$(_is_inside_git_tree) if [[ "$is_tree" -ne 0 ]]; then - _abort "repository is broken. try running 'git init' or 'git clone'." + _abort "not in dir with git repo. Use 'git init' or 'git clone', then in repo use 'git secret init'" fi # Checking if the '.gitsecret' is not ignored: @@ -27,7 +27,7 @@ function _check_setup { function _incorrect_usage { - echo "$1" + echo "git-server: abort: $1" usage exit "$2" } diff --git a/tests/test_init.bats b/tests/test_init.bats index 2a212731..79d3fad5 100644 --- a/tests/test_init.bats +++ b/tests/test_init.bats @@ -71,6 +71,6 @@ function teardown { mkdir "$secrets_dir" run git secret init - [ "$output" = "already inited. abort." ] + [ "$output" = "git-secret: abort: already inited." ] [ "$status" -eq 1 ] }