From 4f2bc5cadf33f8424ccd62953b41a11e4434a6c9 Mon Sep 17 00:00:00 2001 From: Arne Schmitz Date: Wed, 2 Dec 2015 14:09:27 +0100 Subject: [PATCH 1/2] add env variable for showing of untracked files --- gitstatus.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gitstatus.sh b/gitstatus.sh index 782230e..4bf276a 100755 --- a/gitstatus.sh +++ b/gitstatus.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# -*- coding: UTF-8 -*- +# -*- coding: utf-8 -*- # gitstatus.sh -- produce the current git repo status on STDOUT # Functionally equivalent to 'gitstatus.py', but written in bash (not python). # @@ -15,7 +15,11 @@ if [ -z "${__GIT_PROMPT_DIR}" ]; then __GIT_PROMPT_DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )" fi -gitstatus=$( LC_ALL=C git status --untracked-files=all --porcelain --branch ) +if [ -z "${GIT_SHOW_UNTRACKED_FILES}" ]; then + GIT_SHOW_UNTRACKED_FILES="all" +fi + +gitstatus=$( LC_ALL=C git status --untracked-files=${GIT_SHOW_UNTRACKED_FILES} --porcelain --branch ) # if the status is fatal, exit now [[ "$?" -ne 0 ]] && exit 0 From aa0b32fdb5f30cb6a5a94637e940f93e173124cb Mon Sep 17 00:00:00 2001 From: Arne Schmitz Date: Fri, 4 Dec 2015 10:21:31 +0100 Subject: [PATCH 2/2] add documentation for GIT_SHOW_UNTRACKED_FILES --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 74e88c3..fd2fe29 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,8 @@ git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt # GIT_PROMPT_FETCH_REMOTE_STATUS=0 # uncomment to avoid fetching remote status # GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch - + # GIT_SHOW_UNTRACKED_FILES=all # can be no, normal or all; determines counting of untracked files + # GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10 # GIT_PROMPT_START=... # uncomment for custom prompt start sequence @@ -136,6 +137,10 @@ git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt source ~/.bash-git-prompt/gitprompt.sh ``` +You can set the `GIT_SHOW_UNTRACKED_FILES` variable to `no` or `normal` to speed things up if you have lots of +untracked files in your repository. This can be the case for build systems that put their build artifacts in +the subdirectory structure of the git repository. + - `cd` to a git repository and test it! #### Themes