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 <myoga.murase@gmail.com>
This commit is contained in:
Charadon
2022-09-17 10:02:08 -04:00
committed by Koichi Murase
parent 81e2726867
commit ea20d4cd81

View File

@ -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")