lib/omb-prompt-base: Check "oh-my-{bash,zsh}.hide-status" for git status

This commit is contained in:
Koichi Murase 2024-02-21 19:48:06 +09:00
parent d55683133b
commit 1e326a7d6f

View File

@ -108,6 +108,11 @@ function _omb_prompt_git {
command git "$@"
}
function _omb_prompt_git_status_enabled {
[[ $(_omb_prompt_git config --get-regexp '^(oh-my-zsh|bash-it|oh-my-bash)\.hide-status$' |
awk '$2== "1" {hide_status = 1;} END { print hide_status; }') != "1" ]]
}
function scm {
if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE
elif [[ -f .git/HEAD ]]; then SCM=$SCM_GIT
@ -186,7 +191,7 @@ function git_prompt_minimal_info {
local git_status_flags=('--porcelain')
SCM_STATE=${SCM_THEME_PROMPT_CLEAN}
if [[ "$(_omb_prompt_git config --get bash-it.hide-status)" != "1" ]]; then
if _omb_prompt_git_status_enabled; then
# Get the branch reference
ref=$(git_clean_branch) || \
ref=$(_omb_prompt_git rev-parse --short HEAD 2> /dev/null) || return 0