mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Make untracked in prompt behave how I want
This commit is contained in:
parent
82808837a2
commit
c31592c601
1 changed files with 7 additions and 11 deletions
18
lib/git.zsh
18
lib/git.zsh
|
|
@ -5,18 +5,14 @@ function git_prompt_info() {
|
|||
}
|
||||
|
||||
parse_git_dirty () {
|
||||
gitstat=$(git status 2>/dev/null | grep '\(# Untracked\|# Changes\|# Changed but not updated:\)')
|
||||
gitstat=$(git status 2> /dev/null | tail -n1)
|
||||
|
||||
if [[ $(echo ${gitstat} | grep -c "^# Changes to be committed:$") > 0 ]]; then
|
||||
echo -n "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
fi
|
||||
|
||||
if [[ $(echo ${gitstat} | grep -c "^\(# Untracked files:\|# Changed but not updated:\)$") > 0 ]]; then
|
||||
echo -n "$ZSH_THEME_GIT_PROMPT_UNTRACKED"
|
||||
fi
|
||||
|
||||
if [[ $(echo ${gitstat} | wc -l | tr -d ' ') == 0 ]]; then
|
||||
echo -n "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
if [[ $(echo ${gitstat} | grep -c "nothing added to commit but untracked files present") > 0 ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_UNTRACKED"
|
||||
elif [[ ${gitstat} != "nothing to commit (working directory clean)" ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue