From 2ec706e30dfff503a575df0c8d5d5986d263c4bd Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 17 Dec 2018 10:32:23 +0100 Subject: [PATCH] Fix shellcheck warnings Fix the following warnings from shellcheck: ----------------------------------------------------------------------- In populate-fully.sh line 18: if kill -0 $(cat "$LOCKDIR/pid") 2>/dev/null; ^-- SC2046: Quote this to prevent word splitting. In populate-sparsely.sh line 18: . "$XDG_CONFIG_HOME/vcsh/hooks-available/sparse-checkout.sh" ^-- SC1090: Can't follow non-constant source. Use a directive to specify location. ----------------------------------------------------------------------- --- .config/vcsh/hooks-available/populate-fully.sh | 2 +- .config/vcsh/hooks-available/populate-sparsely.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.config/vcsh/hooks-available/populate-fully.sh b/.config/vcsh/hooks-available/populate-fully.sh index d398a90..6af9ebd 100755 --- a/.config/vcsh/hooks-available/populate-fully.sh +++ b/.config/vcsh/hooks-available/populate-fully.sh @@ -15,7 +15,7 @@ then echo "An instance of vcsh already entered a repository." 1>&2 # Exit vcsh if the process which keeps the lock is still alive. - if kill -0 $(cat "$LOCKDIR/pid") 2>/dev/null; + if kill -0 "$(cat "$LOCKDIR/pid")" 2>/dev/null; then # Kill the parent process instead of just bailing out because vcsh does # not catch the hook exit value. diff --git a/.config/vcsh/hooks-available/populate-sparsely.sh b/.config/vcsh/hooks-available/populate-sparsely.sh index 33c1fb0..0561add 100755 --- a/.config/vcsh/hooks-available/populate-sparsely.sh +++ b/.config/vcsh/hooks-available/populate-sparsely.sh @@ -15,6 +15,8 @@ LOCKPID=$(cat "$LOCKDIR/pid") [ "$LOCKPID" = $PPID ] || { echo "Repository entered from another vcsh instance. Aborting." 1>&2; exit 1; } : "${XDG_CONFIG_HOME:="$HOME/.config"}" + +# shellcheck source=/dev/null . "$XDG_CONFIG_HOME/vcsh/hooks-available/sparse-checkout.sh" # Verify if the current branch is valid before updating the working tree. -- 2.1.4