git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Elia Pinto <gitter.spiros@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH] git-submodule.sh: avoid "test <cond> -a/-o <cond>"
Date: Tue, 10 Jun 2014 15:47:03 -0400	[thread overview]
Message-ID: <CAPig+cTTOCe0-U_bMbzo6fp3PFsN+8eJHi9iTxoE9d3UHyRMhg@mail.gmail.com> (raw)
In-Reply-To: <1402418594-1377-1-git-send-email-gitter.spiros@gmail.com>

On Tue, Jun 10, 2014 at 12:43 PM, Elia Pinto <gitter.spiros@gmail.com> wrote:
> The construct is error-prone; "test" being built-in in most modern
> shells, the reason to avoid "test <cond> && test <cond>" spawning
> one extra process by using a single "test <cond> -a <cond>" no
> longer exists.
>
> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
> ---
> This is the fifth revision.
>
> Change based on Junio bugfix and better rewrite of the case condition
> http://permalink.gmane.org/gmane.comp.version-control.git/251198
>
> I dropped also the echo -> printf replacement for doing
> it in another patch.
>
> Pass all the t/*submodule* tests. Finally ! :=)
>
> Thank you all very much and sorry for the mess.
>
>  git-submodule.sh |   32 ++++++++++++++++++++------------
>  1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/git-submodule.sh b/git-submodule.sh
> index e146b83..e128a4a 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
>                 while read mod_src mod_dst sha1_src sha1_dst status sm_path
>                 do
>                         # Always show modules deleted or type-changed (blob<->module)
> -                       test $status = D -o $status = T && echo "$sm_path" && continue
> +                       if test "$status" = D || test "$status" = T
> +                        then
> +                               echo "$sm_path" &&

Unnecessary &&.

> +                               continue
> +                       fi
>                         # Respect the ignore setting for --for-status.
>                         if test -n "$for_status"
>                         then
>                                 name=$(module_name "$sm_path")
>                                 ignore_config=$(get_submodule_config "$name" ignore none)
> -                               test $status != A -a $ignore_config = all && continue
> +                               test $status != A && test $ignore_config = all && continue
>                         fi
>                         # Also show added or modified modules which are checked out
>                         GIT_DIR="$sm_path/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&

  parent reply	other threads:[~2014-06-10 20:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 16:43 [PATCH] git-submodule.sh: avoid "test <cond> -a/-o <cond>" Elia Pinto
2014-06-10 17:02 ` Junio C Hamano
2014-06-10 17:03 ` Junio C Hamano
2014-06-10 19:47 ` Eric Sunshine [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-06-10 12:28 Elia Pinto
2014-06-10 14:42 ` Junio C Hamano
2014-06-10 14:52 ` Torsten Bögershausen
2014-06-10 15:23   ` Junio C Hamano
2014-06-10 15:32     ` Junio C Hamano
2014-06-10 14:55 ` Junio C Hamano
2014-06-10 15:20   ` Johannes Sixt
2014-06-10 15:36     ` 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=CAPig+cTTOCe0-U_bMbzo6fp3PFsN+8eJHi9iTxoE9d3UHyRMhg@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=gitter.spiros@gmail.com \
    --cc=jrnieder@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).