From: Shawn O. Pearce Date: Tue, 21 Jul 2009 17:19:52 GMT Subject: Re: [PATCH] Show the presence of untracked files in the bash prompt. Message-ID: <20090721171952.GS11191@spearce.org> In-Reply-To: <20090721171445.GA25762@bug.science-computing.de> Daniel Trstenjak 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.