summaryrefslogtreecommitdiff
path: root/contrib/completion/git-prompt.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-08-23 05:26:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-08-25 19:21:17 (GMT)
commit0fa7f01635aa0356823d5cbb5109f61b0f307e4b (patch)
treef416d9b40dbb8eb3413a5d34ac232813da112b07 /contrib/completion/git-prompt.sh
parent32f56600bb6ac6fc57183e79d2c1515dfa56672f (diff)
downloadgit-0fa7f01635aa0356823d5cbb5109f61b0f307e4b.zip
git-0fa7f01635aa0356823d5cbb5109f61b0f307e4b.tar.gz
git-0fa7f01635aa0356823d5cbb5109f61b0f307e4b.tar.bz2
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>
Diffstat (limited to 'contrib/completion/git-prompt.sh')
-rw-r--r--contrib/completion/git-prompt.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 9d684b1..c5473dc 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -468,7 +468,8 @@ __git_ps1 ()
fi
fi
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] &&
- [ -r "$g/refs/stash" ]; then
+ git rev-parse --verify --quiet refs/stash >/dev/null
+ then
s="$"
fi