summaryrefslogtreecommitdiff
path: root/contrib/completion/git-prompt.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-11-09 14:06:29 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-11-09 14:06:29 -0800
commit4560eae44f43d6cda027550dbc814bb4b1a9f638 (patch)
tree73b7531b9a17127b37e4650ea4f70291ab4811f7 /contrib/completion/git-prompt.sh
parentMerge branch 'jk/sideband-more-error-checking' (diff)
parentzsh: update copyright notices (diff)
downloadtgif-4560eae44f43d6cda027550dbc814bb4b1a9f638.tar.xz
Merge branch 'fc/zsh-completion'
Zsh autocompletion (in contrib/) update. * fc/zsh-completion: (29 commits) zsh: update copyright notices completion: bash: remove old compat wrappers completion: bash: cleanup cygwin check completion: bash: trivial cleanup completion: zsh: add simple version check completion: zsh: trivial simplification completion: zsh: add alias descriptions completion: zsh: improve command tags completion: zsh: refactor command completion completion: zsh: shuffle functions around completion: zsh: simplify file_direct completion: zsh: simplify nl_append completion: zsh: trivial cleanup completion: zsh: simplify direct compadd completion: zsh: simplify compadd functions completion: zsh: fix splitting of words completion: zsh: add missing direct_append completion: fix conflict with bashcomp completion: zsh: fix completion for --no-.. options completion: bash: remove zsh wrapper ...
Diffstat (limited to 'contrib/completion/git-prompt.sh')
-rw-r--r--contrib/completion/git-prompt.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 16260bab73..54e123d632 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -97,7 +97,8 @@
# If you would like a colored hint about the current dirty state, set
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
# the colored output of "git status -sb" and are available only when
-# using __git_ps1 for PROMPT_COMMAND or precmd.
+# using __git_ps1 for PROMPT_COMMAND or precmd in Bash,
+# but always available in Zsh.
#
# If you would like __git_ps1 to do nothing in the case when the current
# directory is set up to be ignored by git, then set
@@ -553,9 +554,11 @@ __git_ps1 ()
local z="${GIT_PS1_STATESEPARATOR-" "}"
- # NO color option unless in PROMPT_COMMAND mode
- if [ $pcmode = yes ] && [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
- __git_ps1_colorize_gitstring
+ # NO color option unless in PROMPT_COMMAND mode or it's Zsh
+ if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
+ if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
+ __git_ps1_colorize_gitstring
+ fi
fi
b=${b##refs/heads/}