Commit 99abb82f authored by Felipe Rodrigues de Almeida's avatar Felipe Rodrigues de Almeida Committed by Bruno Pinto

Took the extra 0 out

parent 4ab4cb5c
...@@ -3,10 +3,14 @@ function _git_branch_name ...@@ -3,10 +3,14 @@ function _git_branch_name
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end end
function _git_vs_upstream function _upstream_count
set count (command git rev-list --count --left-right "origin/$argv"...HEAD ^/dev/null) echo (command git rev-list --count --left-right origin/(_git_branch_name)...HEAD ^/dev/null)
end
function _git_up_info
if [ (_upstream_count) ]
set -l count (_upstream_count)
if count
switch $count switch $count
case "" # no upstream case "" # no upstream
echo '' echo ''
...@@ -17,7 +21,9 @@ function _git_vs_upstream ...@@ -17,7 +21,9 @@ function _git_vs_upstream
case "??0" # behind upstream case "??0" # behind upstream
echo 'u-'(echo $count | cut -f1) echo 'u-'(echo $count | cut -f1)
case '???' # diverged from upstream case '???' # diverged from upstream
echo 'u+'(echo $count | cut -f2)'-'(echo $count | cut -f1) echo $count 'u+'(echo $count | cut -f2)'-'(echo $count | cut -f1)
case '*'
echo ''
end end
end end
end end
...@@ -37,11 +43,11 @@ function fish_prompt ...@@ -37,11 +43,11 @@ function fish_prompt
if [ (_git_branch_name) ] if [ (_git_branch_name) ]
set -l git_branch (_git_branch_name) set -l git_branch (_git_branch_name)
set -l git_vs_upstream (_git_vs_upstream $git_branch) set -l git_vs_upstream (_git_up_info)
if [ (_is_git_dirty) ] if [ (_is_git_dirty) ]
set git_info $yellow '('$git_branch "±" "$git_vs_upstream"')' $normal set git_info $yellow '('$git_branch "±" "$git_vs_upstream"')' $normal
else if [ (_git_vs_upstream $git_branch) ] else if [ (_upstream_count) ]
set git_info $yellow '('$git_branch "$git_vs_upstream"')' $normal set git_info $yellow '('$git_branch "$git_vs_upstream"')' $normal
else else
set git_info $green '('$git_branch')' $normal set git_info $green '('$git_branch')' $normal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment