summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorHarris Miller <hmiller@alteryx.com>2022-02-04 13:08:03 -0700
committerMarc Cornellà <hello@mcornella.com>2022-02-07 17:54:02 +0100
commit9e9831fcf22cf77a797eb277f7155c442ff77f16 (patch)
treed68517a956e3d8e026da6b4373424760863ef74e /themes
parent2d3bae965a445ac0f6edeed0b277a15d09e6a261 (diff)
downloadzsh-9e9831fcf22cf77a797eb277f7155c442ff77f16.tar.gz
zsh-9e9831fcf22cf77a797eb277f7155c442ff77f16.tar.bz2
zsh-9e9831fcf22cf77a797eb277f7155c442ff77f16.zip
fix(bureau): fix never `CLEAN` git status (#10656)
Closes #10656
Diffstat (limited to 'themes')
-rw-r--r--themes/bureau.zsh-theme20
1 files changed, 11 insertions, 9 deletions
diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme
index 50058e213..3ca231f6f 100644
--- a/themes/bureau.zsh-theme
+++ b/themes/bureau.zsh-theme
@@ -25,20 +25,21 @@ bureau_git_branch () {
bureau_git_status() {
local result gitstatus
+ gitstatus="$(command git status --porcelain -b 2>/dev/null)"
# check status of files
- gitstatus=$(command git status --porcelain -b 2> /dev/null)
- if [[ -n "$gitstatus" ]]; then
- if $(echo "$gitstatus" | command grep -q '^[AMRD]. '); then
+ local gitfiles="$(tail -n +2 <<< "$gitstatus")"
+ if [[ -n "$gitfiles" ]]; then
+ if $(echo "$gitfiles" | command grep -q '^[AMRD]. '); then
result+="$ZSH_THEME_GIT_PROMPT_STAGED"
fi
- if $(echo "$gitstatus" | command grep -q '^.[MTD] '); then
+ if $(echo "$gitfiles" | command grep -q '^.[MTD] '); then
result+="$ZSH_THEME_GIT_PROMPT_UNSTAGED"
fi
- if $(echo "$gitstatus" | command grep -q -E '^\?\? '); then
+ if $(echo "$gitfiles" | command grep -q -E '^\?\? '); then
result+="$ZSH_THEME_GIT_PROMPT_UNTRACKED"
fi
- if $(echo "$gitstatus" | command grep -q '^UU '); then
+ if $(echo "$gitfiles" | command grep -q '^UU '); then
result+="$ZSH_THEME_GIT_PROMPT_UNMERGED"
fi
else
@@ -46,13 +47,14 @@ bureau_git_status() {
fi
# check status of local repository
- if $(echo "$gitstatus" | command grep -q '^## .*ahead'); then
+ local gitbranch="$(head -n 1 <<< "$gitstatus")"
+ if $(echo "$gitbranch" | command grep -q '^## .*ahead'); then
result+="$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
- if $(echo "$gitstatus" | command grep -q '^## .*behind'); then
+ if $(echo "$gitbranch" | command grep -q '^## .*behind'); then
result+="$ZSH_THEME_GIT_PROMPT_BEHIND"
fi
- if $(echo "$gitstatus" | command grep -q '^## .*diverged'); then
+ if $(echo "$gitbranch" | command grep -q '^## .*diverged'); then
result+="$ZSH_THEME_GIT_PROMPT_DIVERGED"
fi