Re: [PATCH 08/20] git-mergetool.sh: avoid "test <cond> -a/-o <cond>"
On Fri, Jun 6, 2014 at 7:55 AM, Elia Pinto <gitter.spiros@gmail.com> wrote:
Show 7 quoted lines
> 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 looks good to me. Thanks Elia,
Acked-by: David Aguilar <davvid@gmail.com>
Show 32 quoted lines
> 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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html--
David