summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-12-04 19:19:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-12-04 19:19:12 (GMT)
commit80c17cac368c8acf47d5b79b4f5e40d4018efa42 (patch)
tree894b02474453dd67b3f03ba667afdeb72c35f69d /contrib
parent3a5b6eeceb8ea149ec8c0139f64683942e62722b (diff)
parentc26f70ceb3960603a78010c87f8ad11820ab6561 (diff)
downloadgit-80c17cac368c8acf47d5b79b4f5e40d4018efa42.zip
git-80c17cac368c8acf47d5b79b4f5e40d4018efa42.tar.gz
git-80c17cac368c8acf47d5b79b4f5e40d4018efa42.tar.bz2
Merge branch 'sg/bash-prompt-dirty-orphan'
Produce correct "dirty" marker for shell prompts, even when we are on an orphan or an unborn branch. * sg/bash-prompt-dirty-orphan: bash prompt: indicate dirty index even on orphan branches bash prompt: remove a redundant 'git diff' option bash prompt: test dirty index and worktree while on an orphan branch
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-prompt.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 07b52be..64219e6 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -476,10 +476,9 @@ __git_ps1 ()
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
[ "$(git config --bool bash.showDirtyState)" != "false" ]
then
- git diff --no-ext-diff --quiet --exit-code || w="*"
- if [ -n "$short_sha" ]; then
- git diff-index --cached --quiet HEAD -- || i="+"
- else
+ git diff --no-ext-diff --quiet || w="*"
+ git diff --no-ext-diff --cached --quiet || i="+"
+ if [ -z "$short_sha" ] && [ -z "$i" ]; then
i="#"
fi
fi