git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Erik Werner <martinerikwerner@gmail.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, trsten@science-computing.de,
	Martin Erik Werner <martinerikwerner@gmail.com>
Subject: [PATCH v2 1/3] shell prompt: add bash.showUntrackedFiles option
Date: Wed, 13 Feb 2013 12:01:58 +0100	[thread overview]
Message-ID: <1360753321-5002-1-git-send-email-martinerikwerner@gmail.com> (raw)
In-Reply-To: <1360753138.25490.10.camel@mas>

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

  reply	other threads:[~2013-02-13 11:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12 20:12 [PATCH 0/2] Add bash.showUntrackedFiles config option Martin Erik Werner
2013-02-12 20:12 ` [PATCH 1/2] bash completion: add bash.showUntrackedFiles option Martin Erik Werner
2013-02-12 22:17   ` Junio C Hamano
2013-02-12 20:12 ` [PATCH 2/2] t9903: add test case for bash.showUntrackedFiles Martin Erik Werner
2013-02-12 22:29   ` Junio C Hamano
2013-02-13 10:58     ` [PATCH v2 0/3] Add bash.showUntrackedFiles config option Martin Erik Werner
2013-02-13 11:01       ` Martin Erik Werner [this message]
2013-02-13 11:01         ` [PATCH v2 2/3] t9903: add tests for bash.showUntrackedFiles Martin Erik Werner
2013-02-13 16:23           ` Junio C Hamano
2013-02-13 17:27             ` Martin Erik Werner
2013-02-13 19:51               ` Junio C Hamano
2013-02-13 11:02         ` [PATCH v2 3/3] t9903: add extra tests for bash.showDirtyState Martin Erik Werner
2013-02-13 16:28           ` Junio C Hamano
2013-02-13 17:37             ` Martin Erik Werner
2013-02-13 19:53               ` Junio C Hamano
2013-02-13 20:40                 ` Martin Erik Werner
2013-02-13 20:42                   ` Junio C Hamano
2013-02-13 20:58                     ` [PATCH v3 2/3] t9903: add tests for bash.showUntrackedFiles Martin Erik Werner
2013-02-13 20:58                       ` [PATCH v3 3/3] t9903: add extra tests for bash.showDirtyState Martin Erik Werner
2013-02-13 16:12         ` [PATCH v2 1/3] shell prompt: add bash.showUntrackedFiles option Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360753321-5002-1-git-send-email-martinerikwerner@gmail.com \
    --to=martinerikwerner@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=trsten@science-computing.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).