mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 15:05:27 +08:00
Fix git prompt noise
Issue reported on Gitter: > If I go into an empty git repository (i.e. git init) and hit enter a few times, I get: > fatal: bad revision 'HEAD
This commit is contained in:
parent
91a311c156
commit
4e1226a313
@ -448,7 +448,7 @@ function __fish_git_prompt_staged --description "__fish_git_prompt helper, tells
|
||||
set -l staged
|
||||
|
||||
if test -n "$sha"
|
||||
command git diff-index --cached --quiet HEAD --
|
||||
command git diff-index --cached --quiet HEAD -- ^/dev/null
|
||||
or set staged $___fish_git_prompt_char_stagedstate
|
||||
else
|
||||
set staged $___fish_git_prompt_char_invalidstate
|
||||
@ -460,7 +460,7 @@ function __fish_git_prompt_dirty --description "__fish_git_prompt helper, tells
|
||||
set -l dirty
|
||||
|
||||
set -l os
|
||||
command git diff --no-ext-diff --quiet --exit-code
|
||||
command git diff --no-ext-diff --quiet --exit-code ^/dev/null
|
||||
set os $status
|
||||
if test $os -ne 0
|
||||
set dirty $___fish_git_prompt_char_dirtystate
|
||||
|
Loading…
x
Reference in New Issue
Block a user