diff options
-rw-r--r-- | contrib/completion/git-prompt.sh | 5 | ||||
-rwxr-xr-x | t/t9903-bash-prompt.sh | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh index 6e8f486e66..afa867030d 100644 --- a/contrib/completion/git-prompt.sh +++ b/contrib/completion/git-prompt.sh @@ -435,8 +435,9 @@ __git_ps1 () i="#" fi fi - if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then - git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$" + if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] && + [ -r "$g/refs/stash" ]; then + s="$" fi if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] && diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh index b9895c797c..c05458cbe6 100755 --- a/t/t9903-bash-prompt.sh +++ b/t/t9903-bash-prompt.sh @@ -328,6 +328,7 @@ test_expect_success 'prompt - stash status indicator - stash' ' echo 2 >file && git stash && test_when_finished "git stash drop" && + git pack-refs --all && ( GIT_PS1_SHOWSTASHSTATE=y && __git_ps1 >"$actual" |