From 72f6c7080f441d03ad863a8715a49e20fc245fc4 Mon Sep 17 00:00:00 2001 From: Clumsy-Coder <19594044+Clumsy-Coder@users.noreply.github.com> Date: Tue, 30 Jan 2024 17:32:06 -0700 Subject: [PATCH] fix(zsh:env): add fallback file path when setting env DOTDIR ## what - add fallback file path when setting env DOTDIR ## how ## why - when running `.zshenv` in a `~/.config/zsh` directory, it's not in a git repo, so the command would fail ## where - ./tools/zsh/.zshenv ## usage ## issue or pull request --- tools/zsh/.zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/zsh/.zshenv b/tools/zsh/.zshenv index ce9932d..07be46c 100644 --- a/tools/zsh/.zshenv +++ b/tools/zsh/.zshenv @@ -15,7 +15,7 @@ export XDG_CACHE_HOME="$HOME/.cache" # Where user-specific non-essential # -------------------------------------------------------------------------------------------------# # DIRECTORIES -export DOTDIR=$(git rev-parse --show-toplevel) # used by zshenv and ansible (to link files, etc) +export DOTDIR=$(git rev-parse --show-toplevel 2> /dev/null || echo "$HOME/dotfiles") # used by zshenv and ansible (to link files, etc) export ZDOTDIR="$XDG_CONFIG_HOME/zsh" export ZSCRIPTDIR="$DOTDIR/tools/zsh" export HISTFILE="$XDG_STATE_HOME/zsh/history" # history