From 6df60bdbec411d1c4d1f12397f1fffad4ee9cbe8 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Sun, 22 May 2022 02:25:54 -0700 Subject: [PATCH] env: add check to see if git exists --- .config/shell/env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/shell/env b/.config/shell/env index 6a3b169..a6f7a7c 100644 --- a/.config/shell/env +++ b/.config/shell/env @@ -33,13 +33,13 @@ export ZINIT_HOME_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/zinit" # Set documents directory (auto set to the repo the file ~/todo points to is in) -if [ -h ~/todo ]; then +if [ -h ~/todo ] && command -v git > /dev/null; then # shellcheck disable=SC2155 export DOCS_DIR="$(git -C "$(dirname "$(realpath ~/todo)" 2>&1)" rev-parse --show-toplevel | head -1)" elif [ -d "$HOME/Documents/docs" ]; then export DOCS_DIR="$HOME/Documents/docs/" else - echo "Error: couldn't find the documents repo" >&2 + echo "Error: couldn't find the documents repo" > /dev/null fi ## Working directory save settings (see things at bottom of zshrc)