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>
Martin Erik Werner committed
Feb 13, 2013 at 12:01 UTC
66cb5d4420e6a25d0e9a325a2cf3a3a1acc37449
1 file changed
+8
-3
contrib/completion/git-prompt.sh
+8
-3
@@ -43,7 +43,10 @@
43
#
44
# If you would like to see if there're untracked files, then you can set
45
# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
46
-# files, then a '%' will be shown next to the branch name.
46
+# files, then a '%' will be shown next to the branch name. You can
47
+# configure this per-repository with the bash.showUntrackedFiles
48
+# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
49
+# enabled.
50
#
51
# If you would like to see the difference between HEAD and its upstream,
52
# set GIT_PS1_SHOWUPSTREAM="auto". A "<" indicates you are behind, ">"
@@ -332,8 +335,10 @@ __git_ps1 ()
335
fi
336
337
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
335
- if [ -n "$(git ls-files --others --exclude-standard)" ]; then
336
- u="%"
338
+ if [ "$(git config --bool bash.showUntrackedFiles)" != "false" ]; then
339
+ if [ -n "$(git ls-files --others --exclude-standard)" ]; then
340
+ u="%"
341
+ fi
342
fi
343
fi
344