Skip to content

Commit

Permalink
git-prompt: do not look for refs/stash in $GIT_DIR
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Aug 25, 2014
1 parent 32f5660 commit 0fa7f01
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/completion/git-prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0fa7f01

Please sign in to comment.