oh-my-fish/lib/git/git_ahead.fish
Itzik Ephraim a6a67be60b Use posix stderr redirection (2> instead of ^)
Fish is deprecating `^` as a shortcut for stderr redirection.
Replace with the more common and compatible `2>`.

Fixes #609
2018-06-09 01:23:32 +03:00

19 lines
521 B
Fish

function git_ahead -a ahead behind diverged none
not git_is_repo; and return
set -l commit_count (command git rev-list --count --left-right "@{upstream}...HEAD" 2> /dev/null)
switch "$commit_count"
case ""
# no upstream
case "0"\t"0"
test -n "$none"; and echo "$none"; or echo ""
case "*"\t"0"
test -n "$behind"; and echo "$behind"; or echo "-"
case "0"\t"*"
test -n "$ahead"; and echo "$ahead"; or echo "+"
case "*"
test -n "$diverged"; and echo "$diverged"; or echo "±"
end
end