mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Fix a bug in the default git_prompt_info ()
This commit is contained in:
parent
53da2d86f6
commit
c661eedfb1
1 changed files with 17 additions and 9 deletions
|
|
@ -26,6 +26,11 @@
|
||||||
# # with your format:
|
# # with your format:
|
||||||
# git_prompt_info ()
|
# git_prompt_info ()
|
||||||
# {
|
# {
|
||||||
|
# if [ -z "$(git_prompt__git_dir)" ]; then
|
||||||
|
# GIT_PROMPT_INFO=''
|
||||||
|
# return
|
||||||
|
# fi
|
||||||
|
#
|
||||||
# git_prompt__branch
|
# git_prompt__branch
|
||||||
# local branch_=$GIT_PROMPT_BRANCH
|
# local branch_=$GIT_PROMPT_BRANCH
|
||||||
#
|
#
|
||||||
|
|
@ -63,23 +68,26 @@
|
||||||
# (See the ashleydev theme for more complex usage).
|
# (See the ashleydev theme for more complex usage).
|
||||||
git_prompt_info ()
|
git_prompt_info ()
|
||||||
{
|
{
|
||||||
|
if [ -z "$(git_prompt__git_dir)" ]; then
|
||||||
|
GIT_PROMPT_INFO=''
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
git_prompt__branch
|
git_prompt__branch
|
||||||
local branch=$GIT_PROMPT_BRANCH
|
local branch=$GIT_PROMPT_BRANCH
|
||||||
|
|
||||||
git_prompt__dirty_state
|
git_prompt__dirty_state
|
||||||
local dirty=$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY
|
local dirty=$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY
|
||||||
|
|
||||||
if [[ -n "$branch" ]]; then
|
local prompt=$branch
|
||||||
local prompt=$branch
|
|
||||||
|
|
||||||
if [[ "$dirty" = 'yes' ]]; then
|
if [[ "$dirty" = 'yes' ]]; then
|
||||||
prompt="$prompt$ZSH_THEME_GIT_PROMPT_DIRTY"
|
prompt="$prompt$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||||
elif [[ "$dirty" = 'no' ]]; then
|
elif [[ "$dirty" = 'no' ]]; then
|
||||||
prompt="$prompt$ZSH_THEME_GIT_PROMPT_CLEAN"
|
prompt="$prompt$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||||
fi
|
|
||||||
|
|
||||||
GIT_PROMPT_INFO="$ZSH_THEME_GIT_PROMPT_PREFIX$prompt$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
GIT_PROMPT_INFO="$ZSH_THEME_GIT_PROMPT_PREFIX$prompt$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||||
}
|
}
|
||||||
|
|
||||||
#------------------ git information utils ------------------
|
#------------------ git information utils ------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue