mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
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:
parent
0b63c1f46d
commit
9cfb1394bf
1 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue