From ea20d4cd8118e0b38f52643b661297f9710506a2 Mon Sep 17 00:00:00 2001 From: Charadon Date: Sat, 17 Sep 2022 10:02:08 -0400 Subject: [PATCH] lib/omb-prompt-base: Fix unbound variable error The variable `git_status_flags` was not declared in the function `git_prompt_vars`, so if `set -u` was set in bashrc, it would give unbound variable error constantly with `set -u`. Co-authored-by: Koichi Murase --- lib/omb-prompt-base.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/omb-prompt-base.sh b/lib/omb-prompt-base.sh index 54ebc27..8f92e41 100644 --- a/lib/omb-prompt-base.sh +++ b/lib/omb-prompt-base.sh @@ -233,9 +233,10 @@ function git_status_summary { function git_prompt_vars { local details='' + local git_status_flags='' SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} if [[ "$(git config --get bash-it.hide-status)" != "1" ]]; then - [[ "${SCM_GIT_IGNORE_UNTRACKED}" = "true" ]] && local git_status_flags='-uno' + [[ "${SCM_GIT_IGNORE_UNTRACKED}" = "true" ]] && git_status_flags='-uno' local status_lines=$((git status --porcelain ${git_status_flags} -b 2> /dev/null || git status --porcelain ${git_status_flags} 2> /dev/null) | git_status_summary) local status=$(awk 'NR==1' <<< "$status_lines")