diff options
author | Marc Cornellà <marc.cornella@live.com> | 2016-04-05 21:22:35 +0200 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2016-04-05 21:22:35 +0200 |
commit | b7142922f87d643d8fa6e7c1b339f0ba8aad74d7 (patch) | |
tree | ebedd477736eb96347838488172e4dffcc5d021e /themes/bureau.zsh-theme | |
parent | 286c3e5e28b651c3f629e6aaba589a1cf56da4d8 (diff) | |
parent | 82a4587427ea8246bf74858ace489c81690c3c28 (diff) | |
download | zsh-b7142922f87d643d8fa6e7c1b339f0ba8aad74d7.tar.gz zsh-b7142922f87d643d8fa6e7c1b339f0ba8aad74d7.tar.bz2 zsh-b7142922f87d643d8fa6e7c1b339f0ba8aad74d7.zip |
Merge pull request #4976 from mcornella/bureau-theme-fixes
Bureau theme fixes
Diffstat (limited to 'themes/bureau.zsh-theme')
-rw-r--r-- | themes/bureau.zsh-theme | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme index c6296500d..3b3bdc80f 100644 --- a/themes/bureau.zsh-theme +++ b/themes/bureau.zsh-theme @@ -22,38 +22,44 @@ bureau_git_branch () { echo "${ref#refs/heads/}" } -bureau_git_status () { +bureau_git_status() { _STATUS="" - if [[ $(command git status --short 2> /dev/null) != "" ]]; then - _INDEX=$(command git status --porcelain -b 2> /dev/null) - if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then + + # check status of files + _INDEX=$(command git status --porcelain 2> /dev/null) + if [[ -n "$_INDEX" ]]; then + if $(echo "$_INDEX" | command grep -q '^[AMRD]. '); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" fi - if $(echo "$_INDEX" | command grep '^.[MTD] ' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q '^.[MTD] '); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" fi - if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q -E '^\?\? '); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" fi - if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q '^UU '); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" fi - if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" - fi - if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" - fi - if $(echo "$_INDEX" | command grep '^## .*behind' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" - fi - if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" - fi else _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN" fi + # check status of local repository + _INDEX=$(command git status --porcelain -b 2> /dev/null) + if $(echo "$_INDEX" | command grep -q '^## .*ahead'); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" + fi + if $(echo "$_INDEX" | command grep -q '^## .*behind'); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" + fi + if $(echo "$_INDEX" | command grep -q '^## .*diverged'); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" + fi + + if $(command git rev-parse --verify refs/stash &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" + fi + echo $_STATUS } |