fish: fix git prompt not showing staged changes if there's no commit
This commit is contained in:
parent
ddf010febb
commit
f2f4a01c6a
|
@ -103,9 +103,8 @@ function fish_git_prompt
|
|||
_fish_prompt_warn "init"
|
||||
end
|
||||
|
||||
git rev-parse HEAD -- &>/dev/null
|
||||
or return
|
||||
|
||||
# if we have at least one commit
|
||||
if git rev-parse HEAD -- &>/dev/null
|
||||
# print a "↑" if ahead of origin
|
||||
test 0 -ne (git log --oneline "$git_remote_branch"..HEAD -- | wc -l)
|
||||
and set -f _git_sync_ahead '↑'
|
||||
|
@ -127,6 +126,7 @@ function fish_git_prompt
|
|||
_fish_prompt_normal '↻'
|
||||
_fish_prompt_warn $git_log_unpushed[1]
|
||||
end
|
||||
end
|
||||
|
||||
############################################################
|
||||
# Right side represents WorkTree/Staged
|
||||
|
|
Loading…
Reference in a new issue