mirror of
https://github.com/lowne/fish-prompt-metro.git
synced 2024-10-27 20:34:12 +00:00
9 lines
495 B
Fish
9 lines
495 B
Fish
function git_ahead -a ahead behind diverged none
|
|
command git rev-list --count --left-right "@{upstream}...HEAD" 2>/dev/null | command awk "
|
|
/^0\t0/ { print \"$none\" ? \"$none\" : \"\"; exit 0 }
|
|
/^[0-9]+\t0/ { print \"$behind\" ? \"$behind\" : \"-\"; exit 0 }
|
|
/^0\t[0-9]+/ { print \"$ahead\" ? \"$ahead\" : \"+\"; exit 0 }
|
|
// { print \"$diverged\" ? \"$diverged\" : \"±\"; exit 0 }
|
|
"
|
|
end
|