mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +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
|
set -l staged
|
||||||
|
|
||||||
if test -n "$sha"
|
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
|
or set staged $___fish_git_prompt_char_stagedstate
|
||||||
else
|
else
|
||||||
set staged $___fish_git_prompt_char_invalidstate
|
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 dirty
|
||||||
|
|
||||||
set -l os
|
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
|
set os $status
|
||||||
if test $os -ne 0
|
if test $os -ne 0
|
||||||
set dirty $___fish_git_prompt_char_dirtystate
|
set dirty $___fish_git_prompt_char_dirtystate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user