All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Martin Erik Werner <martinerikwerner@gmail.com>
Cc: gitster@pobox.com, git@vger.kernel.org,
	trsten@science-computing.de,
	Simon Oosthoek <s.oosthoek@xs4all.nl>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: Re: [PATCH] shell-prompt: clean up nested if-then
Date: Mon, 18 Feb 2013 11:10:40 -0800	[thread overview]
Message-ID: <20130218191040.GB3234@elie.Belkin> (raw)
In-Reply-To: <1361204601-4573-1-git-send-email-martinerikwerner@gmail.com>

Hi Martin,

Martin Erik Werner wrote:

> Minor clean up of if-then nesting in checks for environment variables
> and config options. No functional changes.

Yeah, the nesting was getting a little deep.  Thanks for the cleanup.
May we have your sign-off?

Once this is signed off,
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Patch left unsnipped for reference.

> ---
>  contrib/completion/git-prompt.sh |   27 +++++++++++++--------------
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> index 9b2eec2..e29694d 100644
> --- a/contrib/completion/git-prompt.sh
> +++ b/contrib/completion/git-prompt.sh
> @@ -320,26 +320,25 @@ __git_ps1 ()
>  				b="GIT_DIR!"
>  			fi
>  		elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
> -			if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
> -				if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
> -					git diff --no-ext-diff --quiet --exit-code || w="*"
> -					if git rev-parse --quiet --verify HEAD >/dev/null; then
> -						git diff-index --cached --quiet HEAD -- || i="+"
> -					else
> -						i="#"
> -					fi
> +			if test -n "${GIT_PS1_SHOWDIRTYSTATE-}" &&
> +			   test "$(git config --bool bash.showDirtyState)" != "false"
> +			then
> +				git diff --no-ext-diff --quiet --exit-code || w="*"
> +				if git rev-parse --quiet --verify HEAD >/dev/null; then
> +					git diff-index --cached --quiet HEAD -- || i="+"
> +				else
> +					i="#"
>  				fi
>  			fi
>  			if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
>  				git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
>  			fi
>  
> -			if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
> -				if [ "$(git config --bool bash.showUntrackedFiles)" != "false" ]; then
> -					if [ -n "$(git ls-files --others --exclude-standard)" ]; then
> -						u="%"
> -					fi
> -				fi
> +			if test -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" &&
> +			   test "$(git config --bool bash.showUntrackedFiles)" != "false" &&
> +			   test -n "$(git ls-files --others --exclude-standard)"
> +			then
> +				u="%"
>  			fi
>  
>  			if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
> -- 

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

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1361204512.4758.10.camel@mas>
2013-02-18 16:23 ` [PATCH] shell-prompt: clean up nested if-then Martin Erik Werner
2013-02-18 19:10   ` Jonathan Nieder [this message]
     [not found]     ` <0c94f24b-f7ee-4699-87a7-6861b927cea4@email.android.com>
2013-02-18 22:56       ` Martin Erik Werner
2013-02-18 22:59         ` [PATCH v2] " martinerikwerner
2013-02-18 23:28           ` Jonathan Nieder
2013-02-18 23:07         ` [PATCH] " Junio C Hamano
2013-02-19  8:17           ` Simon Oosthoek
2013-02-19 16:28             ` 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=20130218191040.GB3234@elie.Belkin \
    --to=jrnieder@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=martinerikwerner@gmail.com \
    --cc=s.oosthoek@xs4all.nl \
    --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 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.