[PATCH 1/2] bash completion: add bash.showUntrackedFiles option
- From
Martin Erik Werner <martinerikwerner@gmail.com>
- Date
- Feb 12, 2013, 20:12 UTC
- Message-ID
- <1360699936-28688-2-git-send-email-martinerikwerner@gmail.com>
- In-Reply-To
- <1360699936-28688-1-git-send-email-martinerikwerner@gmail.com>
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> --- contrib/completion/git-prompt.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh index 9bef053..9b2eec2 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
-- 1.7.10.4