diff options
author | Hugues Hiegel <hugues.hiegel@qosmos.com> | 2013-08-01 15:15:28 +0200 |
---|---|---|
committer | Hugues Hiegel <hugues.hiegel@qosmos.com> | 2013-08-01 15:49:20 +0200 |
commit | 56f2fd9c0446a2a77322ed0270ac9d8778a1d489 (patch) | |
tree | 3ff4a5b260a24ef0f77d2b0706a8c636c68a2684 /01_Internal.zsh | |
parent | abd3b826bedf0bf423da1d778bda53c889e29911 (diff) |
[Git] Better ahead/behind/diverged managment
Diffstat (limited to '01_Internal.zsh')
-rw-r--r-- | 01_Internal.zsh | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/01_Internal.zsh b/01_Internal.zsh index 0673915..575cc3e 100644 --- a/01_Internal.zsh +++ b/01_Internal.zsh @@ -244,22 +244,32 @@ __get_git_branch () local _ahead=0 ; local _behind=0 ; eval $(git status . | sed -n ' - /^#$/ { q } + /^#$/ { q } s/^# and have \([0-9]\+\) and \([0-9]\+\) different.*/_ahead=\1;\n_behind=\2;\n/p ; s/^# Your branch is \(behind\|ahead\) .* \([0-9]\+\) commit.*/_\1=\2;\n/p ; ') + # ᛨ ᛪ ⇅ ↟↟ ⇶ ⇶ ⇵ ⌥ ⬆ ⬇ ⬌ ⬍ ⤱ ⤲ ✖ ➠ ➟ ⤴ ⎇⬋⬉⬉⬈⬌⬍⬅⬄ + [ $(($_ahead + $_behind)) -gt 0 ] && my_git_branch+=" " - if [ $_ahead -gt 0 ] - then - my_git_branch+=$C_$_gcl_colors[cached]$_C"↑"$C_$_prompt_colors[soft_generic]$_C - [ $_ahead -gt 1 ] && my_git_branch+="₊$(echo $_ahead | _subscript_number)" - fi - if [ $_behind -gt 0 ] - then - my_git_branch+=$C_$_prompt_colors[bold_generic]";"$color[blink]$_C"↓"$C_$_prompt_colors[bold_generic]$_C - [ $_behind -gt 1 ] && my_git_branch+="₊$(echo $_behind | _subscript_number)" - fi + + if [ $_ahead -gt 0 -a $_behind -gt 0 ] + then + my_git_branch+=$C_$_gcl_colors[diverged]$_C + my_git_branch+="✖ " + fi + if [ $_behind -gt 0 ] + then + my_git_branch+=$C_$_gcl_colors[ffwd]$_C + [ $_behind -gt 1 ] && my_git_branch+="$(echo $_behind | _subscript_number)" + my_git_branch+="⬇" + fi + if [ $_ahead -gt 0 ] + then + my_git_branch+=$C_$_gcl_colors[cached]$_C + my_git_branch+="⬆" + [ $_ahead -gt 1 ] && my_git_branch+="$(echo $_ahead | _subscript_number)" + fi fi echo $my_git_branch @@ -364,12 +374,14 @@ __get_git_status () __debug - __debug -n " merges..." - if [ $(git status . | sed -n '2{/can be fast-forwarded/p;/have diverged/p;q}' | wc -l) -gt 0 ] + __debug -n " diverged..." + if [ $(git status . | sed -n '2{/have diverged/p;q}' | wc -l) -gt 0 ] then - my_git_status+=";$_gcl_colors[ffwd]" + my_git_status+=";$color[standout]" fi + __debug + __debug -n " merges..." if [ $(git ls-files --unmerged | wc -l) -gt 0 ] then my_git_status="${_gcl_colors[merging]:+$_gcl_colors[merging];}$my_git_status" |