Re: [PATCH] Show the presence of untracked files in the bash prompt.
Daniel Trstenjak <daniel.trstenjak@science-computing.de> wrote:
Show 11 quoted lines
> 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" ]; thenWouldn't using -n be easier here?
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
--
Shawn.