b7142922f87d643d8fa6e7c1b339f0ba8aad74d7
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Merge pull request #4976 from mcornella/bureau-theme-fixes
Bureau theme fixes
Diff
1diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme
2index c6296500d06be47e0e57aaa05912f417aa4fda7c..3b3bdc80f3183da358a6ef1720bc0ed4f8f7dda5 100644
3--- a/themes/bureau.zsh-theme
4+++ b/themes/bureau.zsh-theme
5@@ -22,38 +22,44 @@ bureau_git_branch () {
6 echo "${ref#refs/heads/}"
7 }
8
9-bureau_git_status () {
10+bureau_git_status() {
11 _STATUS=""
12- if [[ $(command git status --short 2> /dev/null) != "" ]]; then
13- _INDEX=$(command git status --porcelain -b 2> /dev/null)
14- if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then
15+
16+ # check status of files
17+ _INDEX=$(command git status --porcelain 2> /dev/null)
18+ if [[ -n "$_INDEX" ]]; then
19+ if $(echo "$_INDEX" | command grep -q '^[AMRD]. '); then
20 _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
21 fi
22- if $(echo "$_INDEX" | command grep '^.[MTD] ' &> /dev/null); then
23+ if $(echo "$_INDEX" | command grep -q '^.[MTD] '); then
24 _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
25 fi
26- if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then
27+ if $(echo "$_INDEX" | command grep -q -E '^\?\? '); then
28 _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
29 fi
30- if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then
31+ if $(echo "$_INDEX" | command grep -q '^UU '); then
32 _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
33 fi
34- if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
35- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED"
36- fi
37- if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then
38- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
39- fi
40- if $(echo "$_INDEX" | command grep '^## .*behind' &> /dev/null); then
41- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
42- fi
43- if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then
44- _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED"
45- fi
46 else
47 _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
48 fi
49
50+ # check status of local repository
51+ _INDEX=$(command git status --porcelain -b 2> /dev/null)
52+ if $(echo "$_INDEX" | command grep -q '^## .*ahead'); then
53+ _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
54+ fi
55+ if $(echo "$_INDEX" | command grep -q '^## .*behind'); then
56+ _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
57+ fi
58+ if $(echo "$_INDEX" | command grep -q '^## .*diverged'); then
59+ _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED"
60+ fi
61+
62+ if $(command git rev-parse --verify refs/stash &> /dev/null); then
63+ _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED"
64+ fi
65+
66 echo $_STATUS
67 }
68