From 4cdad1d4d565157119d76093a9fe973c2e54af5a Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 4 Dec 2014 07:11:52 +0100 Subject: [PATCH] Handle missing $1 in _autoenv_hash_pair --- autoenv.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autoenv.zsh b/autoenv.zsh index 23866f3..c710389 100644 --- a/autoenv.zsh +++ b/autoenv.zsh @@ -122,12 +122,18 @@ _autoenv_debug() { zmodload -F zsh/stat b:zstat +# Generate hash pair for a given file ($1). +# A fixed hash value can be given as 2nd arg, but is used with tests only. _autoenv_hash_pair() { local env_file=${1:A} local env_shasum if [[ -n $2 ]]; then env_shasum=$2 else + if ! [[ -e $env_file ]]; then + echo "Missing file argument for _autoenv_hash_pair!" >&2 + return 1 + fi env_shasum=$(shasum $env_file | cut -d' ' -f1) fi echo "$env_file:$env_shasum:1"