mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-07-17 05:51:18 +02:00
Update git plugin with fast dirty check
This commit is contained in:
parent
fec0089cdd
commit
2fb877114e
1 changed files with 16 additions and 6 deletions
22
lib/git.zsh
22
lib/git.zsh
|
|
@ -20,12 +20,22 @@ function parse_git_dirty() {
|
||||||
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
||||||
FLAGS+='--untracked-files=no'
|
FLAGS+='--untracked-files=no'
|
||||||
fi
|
fi
|
||||||
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
|
|
||||||
fi
|
if [[ "$(command git config --get oh-my-zsh.fast-dirty-check)" == "1" ]]; then
|
||||||
if [[ -n $STATUS ]]; then
|
command git diff --no-ext-diff --quiet --exit-code
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
if [[ $? == "0" ]]; then
|
||||||
else
|
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
else
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
|
||||||
|
if [[ -n $STATUS ]]; then
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||||
|
else
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue