aboutsummaryrefslogtreecommitdiff
path: root/contrib/completion/git-prompt.sh
diff options
context:
space:
mode:
authorMartin Erik Werner <martinerikwerner@gmail.com>2013-02-13 12:01:58 +0100
committerJunio C Hamano <gitster@pobox.com>2013-02-13 08:06:57 -0800
commit66cb5d4420e6a25d0e9a325a2cf3a3a1acc37449 (patch)
treed1a066b904719a20415ff7094252e2405eeaed94 /contrib/completion/git-prompt.sh
parent5bf72ed2e7ef82d5ef7a35c978dc72576fdb0efc (diff)
downloadgit-66cb5d4420e6a25d0e9a325a2cf3a3a1acc37449.tar.gz
git-66cb5d4420e6a25d0e9a325a2cf3a3a1acc37449.tar.xz
shell prompt: add bash.showUntrackedFiles option
Add a config option 'bash.showUntrackedFiles' which allows enabling the prompt showing untracked files on a per-repository basis. This is useful for some repositories where the 'git ls-files ...' command may take a long time. Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion/git-prompt.sh')
-rw-r--r--contrib/completion/git-prompt.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 9bef0531c..9b2eec21e 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -43,7 +43,10 @@
#
# If you would like to see if there're untracked files, then you can set
# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
-# files, then a '%' will be shown next to the branch name.
+# files, then a '%' will be shown next to the branch name. You can
+# configure this per-repository with the bash.showUntrackedFiles
+# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
+# enabled.
#
# If you would like to see the difference between HEAD and its upstream,
# set GIT_PS1_SHOWUPSTREAM="auto". A "<" indicates you are behind, ">"
@@ -332,8 +335,10 @@ __git_ps1 ()
fi
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
- if [ -n "$(git ls-files --others --exclude-standard)" ]; then
- u="%"
+ if [ "$(git config --bool bash.showUntrackedFiles)" != "false" ]; then
+ if [ -n "$(git ls-files --others --exclude-standard)" ]; then
+ u="%"
+ fi
fi
fi