Commit 4ab4cb5c authored by Felipe Rodrigues de Almeida's avatar Felipe Rodrigues de Almeida Committed by Bruno Pinto

Preventing error when the branch isn't on upstream

parent 82cab1f6
...@@ -6,18 +6,20 @@ end ...@@ -6,18 +6,20 @@ end
function _git_vs_upstream function _git_vs_upstream
set count (command git rev-list --count --left-right "origin/$argv"...HEAD ^/dev/null) set count (command git rev-list --count --left-right "origin/$argv"...HEAD ^/dev/null)
switch $count if count
case "" # no upstream switch $count
echo '' case "" # no upstream
case "0?0" # equal to upstream echo ''
echo '' case "0?0" # equal to upstream
case "0??" # ahead of upstream echo ''
echo 'u+'(echo $count | cut -f2) case "0??" # ahead of upstream
case "??0" # behind upstream echo 'u+'(echo $count | cut -f2)
echo 'u-'(echo $count | cut -f1) case "??0" # behind upstream
case '???' # diverged from upstream echo 'u-'(echo $count | cut -f1)
echo 'u+'(echo $count | cut -f2)'-'(echo $count | cut -f1) case '???' # diverged from upstream
echo 'u+'(echo $count | cut -f2)'-'(echo $count | cut -f1)
end end
end
end end
function _is_git_dirty function _is_git_dirty
......
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