Subject: Re: [PATCH] Show the presence of untracked files in the bash prompt.

From: "Shawn O. Pearce" <[email-masked]>
Date: Tue, 21 Jul 2009 10:19:52 -0700

Daniel Trstenjak <[email-masked]> wrote:
> Added the envvar GIT_PS1_SHOWUNTRACKEDFILES to 'git-completion.bash'.
> When set to a nonempty value, then the char '%' will be shown next
> to the branch name in the bash prompt.
> @@ -156,12 +161,19 @@ __git_ps1 ()
>  			if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
>  			        git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
>  			fi
> +
> +			if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
> +			   local num_untracked_files=$(git ls-files --others --exclude-standard | wc -l)
> +			   if [ $num_untracked_files -gt "0" ]; then

Wouldn't using -n be easier here?

   if [ -n "$(git ls-files --others --exclude-standard)" ]; then

-- 
Shawn.