summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo R. D'Avila <erdavila@gmail.com>2013-06-26 00:05:17 -0300
committerJunio C Hamano <gitster@pobox.com>2013-06-26 13:03:01 -0700
commitcf4cac4cfc13326920bdbf3d51236e2065f5ba2f (patch)
tree0480748d01ff64b82f67e515e9b055b029103b89
parent15981f4eec9c6a7c12b9c0fbe98e68228c46edb7 (diff)
downloadgit-cf4cac4cfc13326920bdbf3d51236e2065f5ba2f.tar.gz
git-prompt.sh: add missing information in comments
Mention that the command below is needed for prompt in ZSH with PS1: setopt PROMPT_SUBST Rephrase some parts that mention only the "current branch name" being displayed in the prompt. Replace it by stating that the "repository status" is displayed. Make it clear that colored prompt is only available in PROMPT_COMMAND/precmd mode. With-suggestions-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Eduardo R. D'Avila <erdavila@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--contrib/completion/git-prompt.sh26
1 files changed, 15 insertions, 11 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 545518a4db..b3f39e82d5 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -3,7 +3,7 @@
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
-# This script allows you to see the current branch in your prompt.
+# This script allows you to see repository status in your prompt.
#
# To enable:
#
@@ -13,24 +13,27 @@
# 3a) Change your PS1 to call __git_ps1 as
# command-substitution:
# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
-# ZSH: PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
+# ZSH: setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
# the optional argument will be used as format string.
-# 3b) Alternatively, if you are using bash, __git_ps1 can be
-# used for PROMPT_COMMAND with two parameters, <pre> and
+# 3b) Alternatively, __git_ps1 can be used for PROMPT_COMMAND in
+# Bash or for precmd() in ZSH with two parameters, <pre> and
# <post>, which are strings you would put in $PS1 before
# and after the status string generated by the git-prompt
# machinery. e.g.
# Bash: PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
+# will show username, at-sign, host, colon, cwd, then
+# various status string, followed by dollar and SP, as
+# your prompt.
# ZSH: precmd () { __git_ps1 "%n" ":%~$ " "|%s" }
-# will show username, at-sign, host, colon, cwd, then
-# various status string, followed by dollar and SP, as
-# your prompt.
+# will show username, pipe, then various status string,
+# followed by colon, cwd, dollar and SP, as your prompt.
# Optionally, you can supply a third argument with a printf
# format string to finetune the output of the branch status
#
-# The argument to __git_ps1 will be displayed only if you are currently
-# in a git repository. The %s token will be the name of the current
-# branch.
+# The repository status will be displayed only if you are currently in a
+# git repository. The %s token is the placeholder for the shown status.
+#
+# The prompt status always includes the current branch name.
#
# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value,
# unstaged (*) and staged (+) changes will be shown next to the branch
@@ -78,7 +81,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".
+# the colored output of "git status -sb" and are available only when
+# using __git_ps1 for PROMPT_COMMAND or precmd.
# __gitdir accepts 0 or 1 arguments (i.e., location)
# returns location of .git repo