Re: [PATCH 08/20] git-mergetool.sh: avoid "test <cond> -a/-o <cond>"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 6, 2014 at 7:55 AM, Elia Pinto <gitter.spiros@xxxxxxxxx> 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@xxxxxxxxx>
> ---

This looks good to me.  Thanks Elia,

Acked-by: David Aguilar <davvid@xxxxxxxxx>

>  git-mergetool.sh |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index d08dc92..9a046b7 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -205,7 +205,7 @@ checkout_staged_file () {
>                 "$(git checkout-index --temp --stage="$1" "$2" 2>/dev/null)" \
>                 : '\([^ ]*\)    ')
>
> -       if test $? -eq 0 -a -n "$tmpfile"
> +       if test $? -eq 0 && test -n "$tmpfile"
>         then
>                 mv -- "$(git rev-parse --show-cdup)$tmpfile" "$3"
>         else
> @@ -256,7 +256,7 @@ merge_file () {
>         checkout_staged_file 2 "$MERGED" "$LOCAL"
>         checkout_staged_file 3 "$MERGED" "$REMOTE"
>
> -       if test -z "$local_mode" -o -z "$remote_mode"
> +       if test -z "$local_mode" || test -z "$remote_mode"
>         then
>                 echo "Deleted merge conflict for '$MERGED':"
>                 describe_file "$local_mode" "local" "$LOCAL"
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
David
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]