9e9831fcf22cf77a797eb277f7155c442ff77f16
- Author
- Harris Miller <hmiller@alteryx.com>
- Committer
- Marc Cornellà <hello@mcornella.com>
- Date
Message
fix(bureau): fix never `CLEAN` git status (#10656)
Closes #10656
Diff
1diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme
2index 50058e213ef7cdfc20ff9744278390e67e7c02b4..3ca231f6f78484b6ee11d81601045b31c43084e4 100644
3--- a/themes/bureau.zsh-theme
4+++ b/themes/bureau.zsh-theme
5@@ -25,20 +25,21 @@ bureau_git_branch () {
6
7 bureau_git_status() {
8 local result gitstatus
9+ gitstatus="$(command git status --porcelain -b 2>/dev/null)"
10
11 # check status of files
12- gitstatus=$(command git status --porcelain -b 2> /dev/null)
13- if [[ -n "$gitstatus" ]]; then
14- if $(echo "$gitstatus" | command grep -q '^[AMRD]. '); then
15+ local gitfiles="$(tail -n +2 <<< "$gitstatus")"
16+ if [[ -n "$gitfiles" ]]; then
17+ if $(echo "$gitfiles" | command grep -q '^[AMRD]. '); then
18 result+="$ZSH_THEME_GIT_PROMPT_STAGED"
19 fi
20- if $(echo "$gitstatus" | command grep -q '^.[MTD] '); then
21+ if $(echo "$gitfiles" | command grep -q '^.[MTD] '); then
22 result+="$ZSH_THEME_GIT_PROMPT_UNSTAGED"
23 fi
24- if $(echo "$gitstatus" | command grep -q -E '^\?\? '); then
25+ if $(echo "$gitfiles" | command grep -q -E '^\?\? '); then
26 result+="$ZSH_THEME_GIT_PROMPT_UNTRACKED"
27 fi
28- if $(echo "$gitstatus" | command grep -q '^UU '); then
29+ if $(echo "$gitfiles" | command grep -q '^UU '); then
30 result+="$ZSH_THEME_GIT_PROMPT_UNMERGED"
31 fi
32 else
33@@ -46,13 +47,14 @@ bureau_git_status() {
34 fi
35
36 # check status of local repository
37- if $(echo "$gitstatus" | command grep -q '^## .*ahead'); then
38+ local gitbranch="$(head -n 1 <<< "$gitstatus")"
39+ if $(echo "$gitbranch" | command grep -q '^## .*ahead'); then
40 result+="$ZSH_THEME_GIT_PROMPT_AHEAD"
41 fi
42- if $(echo "$gitstatus" | command grep -q '^## .*behind'); then
43+ if $(echo "$gitbranch" | command grep -q '^## .*behind'); then
44 result+="$ZSH_THEME_GIT_PROMPT_BEHIND"
45 fi
46- if $(echo "$gitstatus" | command grep -q '^## .*diverged'); then
47+ if $(echo "$gitbranch" | command grep -q '^## .*diverged'); then
48 result+="$ZSH_THEME_GIT_PROMPT_DIVERGED"
49 fi
50