sample_prompts/sorin: Add a safe way to determine merge status

Based on what __fish_git_prompt is doing.

See #5388.

[ci skip]
This commit is contained in:
Fabian Homborg 2018-12-06 16:15:11 +01:00
parent 0b63c1f46d
commit 9cfb1394bf

View file

@ -16,7 +16,7 @@ function fish_right_prompt
test $status != 0
and printf (set_color red)"⏎ "
if git rev-parse 2>/dev/null
if set -l git_dir (git rev-parse --git-dir 2>/dev/null)
# Magenta if branch detached else green
set -l branch (command git branch -qv | string match "\**")
string match -rq detached -- $branch
@ -25,6 +25,11 @@ function fish_right_prompt
git name-rev --name-only HEAD
# Merging state
test -f "$git_dir/MERGE_HEAD"
and printf ':'(set_color red)'merge'
printf ' '
# Symbols
if set -l count (command git rev-list --count --left-right $upstream...HEAD 2>/dev/null)
echo $count | read -l ahead behind