Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
e1b04cfe
Commit
e1b04cfe
authored
Apr 04, 2016
by
Marc Cornellà
Browse files
Fix logic of bureau_git_status function
This separates the gathering of file status, repository status and stash.
parent
286c3e5e
Changes
1
Show whitespace changes
Inline
Side-by-side
themes/bureau.zsh-theme
View file @
e1b04cfe
...
@@ -22,10 +22,12 @@ bureau_git_branch () {
...
@@ -22,10 +22,12 @@ bureau_git_branch () {
echo "${ref#refs/heads/}"
echo "${ref#refs/heads/}"
}
}
bureau_git_status
() {
bureau_git_status() {
_STATUS=""
_STATUS=""
if [[ $(command git status --short 2> /dev/null) != "" ]]; then
_INDEX=$(command git status --porcelain -b 2> /dev/null)
# check status of files
_INDEX=$(command git status --porcelain 2> /dev/null)
if [[ -n "$_INDEX" ]]; then
if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then
if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
fi
fi
...
@@ -38,9 +40,12 @@ bureau_git_status () {
...
@@ -38,9 +40,12 @@ bureau_git_status () {
if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then
if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
fi
fi
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
else
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_
STASHED
"
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_
CLEAN
"
fi
fi
# check status of local repository
_INDEX=$(command git status --porcelain -b 2> /dev/null)
if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then
if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
fi
...
@@ -50,8 +55,9 @@ bureau_git_status () {
...
@@ -50,8 +55,9 @@ bureau_git_status () {
if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then
if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED"
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED"
fi
fi
else
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
if $(command git rev-parse --verify refs/stash &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED"
fi
fi
echo $_STATUS
echo $_STATUS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment