Skip to content

Commit 0fa7f01

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Reviewed-by: Michael Haggerty <[email protected]> Reviewed-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 32f5660 commit 0fa7f01

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/completion/git-prompt.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ __git_ps1 ()
468468
fi
469469
fi
470470
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] &&
471-
[ -r "$g/refs/stash" ]; then
471+
git rev-parse --verify --quiet refs/stash >/dev/null
472+
then
472473
s="$"
473474
fi
474475

0 commit comments

Comments
 (0)