git-prompt: do not look for refs/stash in $GIT_DIR

Since dd0b72c (bash prompt: use bash builtins to check stash state, 2011-04-01), git-prompt checks whether we have a stash by looking for $GIT_DIR/refs/stash. Generally external programs should never do this, because they would miss packed-refs. That commit claims that packed-refs does not pack refs/stash, but that is not quite true. It does pack the ref, but due to a bug, fails to prune the ref. When we fix that bug, we would want to be doing the right thing here. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 23, 2014 at 01:26 UTC 0fa7f01635aa0356823d5cbb5109f61b0f307e4b
1 file changed +2 -1
contrib/completion/git-prompt.sh
+2 -1
@@ -468,7 +468,8 @@ __git_ps1 ()
468 fi
469 fi
470 if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] &&
471 - [ -r "$g/refs/stash" ]; then
471 + git rev-parse --verify --quiet refs/stash >/dev/null
472 + then
473 s="$"
474 fi
475