From 10262620312454f0ecb736403ab8c51ad00ed9bd Mon Sep 17 00:00:00 2001 From: lelgenio Date: Thu, 2 Jun 2022 15:24:02 -0300 Subject: [PATCH] fish: fix errors with prompt when cwd does not exist --- dotfiles/fish/prompt.fish | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dotfiles/fish/prompt.fish b/dotfiles/fish/prompt.fish index 8b620de..3fbb28b 100644 --- a/dotfiles/fish/prompt.fish +++ b/dotfiles/fish/prompt.fish @@ -51,7 +51,12 @@ function fish_git_prompt command -qs git or return - pushd (string replace -r '/\.git(/.*)?$' '' "$PWD") + set -l here (string replace -r '/\.git(/.*)?$' '' "$PWD") + + test -d "$here" + or return + + pushd "$here" ############################################################ # Check if in a git repo and save branch and status