From e10489afd090a2d9efa52561f1014efedcfde0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 2 Nov 2021 19:51:55 +0100 Subject: [PATCH] Error cleanly if gitstatus.plugin.sh is not found in BASH_SOURCE --- src/segments/git.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/segments/git.bash b/src/segments/git.bash index c6a7a59..ad44f1a 100644 --- a/src/segments/git.bash +++ b/src/segments/git.bash @@ -61,7 +61,8 @@ segments::git::gitstatus() { if [[ -n ${GITSTATUS_DIR:-} ]]; then source "$GITSTATUS_DIR" || return elif [[ ${BASH_SOURCE[0]} == */* ]]; then - source "${BASH_SOURCE[0]%/*}/gitstatus.plugin.sh" || return + local plugin="${BASH_SOURCE[0]%/*}/gitstatus.plugin.sh" + [[ -f $plugin ]] && source "$plugin" || return else source gitstatus.plugin.sh || return fi