mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-09 13:10:40 +00:00
Preventing error when the branch isn't on upstream
This commit is contained in:
parent
82cab1f60d
commit
4ab4cb5cb7
@ -6,18 +6,20 @@ end
|
||||
function _git_vs_upstream
|
||||
set count (command git rev-list --count --left-right "origin/$argv"...HEAD ^/dev/null)
|
||||
|
||||
switch $count
|
||||
case "" # no upstream
|
||||
echo ''
|
||||
case "0?0" # equal to upstream
|
||||
echo ''
|
||||
case "0??" # ahead of upstream
|
||||
echo 'u+'(echo $count | cut -f2)
|
||||
case "??0" # behind upstream
|
||||
echo 'u-'(echo $count | cut -f1)
|
||||
case '???' # diverged from upstream
|
||||
echo 'u+'(echo $count | cut -f2)'-'(echo $count | cut -f1)
|
||||
if count
|
||||
switch $count
|
||||
case "" # no upstream
|
||||
echo ''
|
||||
case "0?0" # equal to upstream
|
||||
echo ''
|
||||
case "0??" # ahead of upstream
|
||||
echo 'u+'(echo $count | cut -f2)
|
||||
case "??0" # behind upstream
|
||||
echo 'u-'(echo $count | cut -f1)
|
||||
case '???' # diverged from upstream
|
||||
echo 'u+'(echo $count | cut -f2)'-'(echo $count | cut -f1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _is_git_dirty
|
||||
|
Loading…
Reference in New Issue
Block a user