All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Daniel Trstenjak <daniel.trstenjak@science-computing.de>
Cc: git@vger.kernel.org, Daniel Trstenjak <Daniel.Trstenjak@online.de>
Subject: Re: [PATCH] Show the presence of untracked files in the bash prompt.
Date: Tue, 21 Jul 2009 10:19:52 -0700	[thread overview]
Message-ID: <20090721171952.GS11191@spearce.org> (raw)
In-Reply-To: <20090721171445.GA25762@bug.science-computing.de>

Daniel Trstenjak <daniel.trstenjak@science-computing.de> 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.

  reply	other threads:[~2009-07-21 17:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21 17:14 [PATCH] Show the presence of untracked files in the bash prompt Daniel Trstenjak
2009-07-21 17:19 ` Shawn O. Pearce [this message]
2009-07-22  8:31   ` Daniel Trstenjak
2009-07-24 15:03     ` Shawn O. Pearce

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=20090721171952.GS11191@spearce.org \
    --to=spearce@spearce.org \
    --cc=Daniel.Trstenjak@online.de \
    --cc=daniel.trstenjak@science-computing.de \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.