From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elia Pinto Subject: [PATCH v2 086/142] t7004-tag.sh: use the $( ... ) construct for command substitution Date: Tue, 25 Mar 2014 10:23:47 -0700 Message-ID: <1395768283-31135-87-git-send-email-gitter.spiros@gmail.com> References: <1395768283-31135-1-git-send-email-gitter.spiros@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Elia Pinto To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Tue Mar 25 18:33:02 2014 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WSVDh-0004n1-4H for gcvg-git-2@plane.gmane.org; Tue, 25 Mar 2014 18:33:01 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755450AbaCYR0k convert rfc822-to-quoted-printable (ORCPT ); Tue, 25 Mar 2014 13:26:40 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34527 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755443AbaCYR01 (ORCPT ); Tue, 25 Mar 2014 13:26:27 -0400 Received: by mail-pa0-f52.google.com with SMTP id rd3so739192pab.25 for ; Tue, 25 Mar 2014 10:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=GPA2OnnVDiLSpSyC39jshKnhA01DI0qdJGkq8bP7NSc=; b=jLp8NR3sQboOqVZciCA0l0sqk/KG4UmXHTb5TuGHdj6Wvd5hbg8UNzesS4aCK+MgrF iwG5kpoAnoSKFa5MccTrcZRVsnyGnnryiCoS+CTO0f/IsQLc8bs9QKJsCHOhSJWsuZni FmZbFGoL0XssHn4Pkr/XNYSfzlsvNZj+974wHIiIbqkKak1vyRE5pQ8ec0wzygrhVnLp evTLctzZW7LvXGVh9A0NOhPrxiYNHfj/40KJ67gU0T76vSIvvdAYzhU2kgdUGysiyoyZ P8DdA+RyW8dPHMt9NfTaJZDWyURGZGYuUc61Gqe+QyOa7XTqlej2xAbZORtEioWGpmOI eFiA== X-Received: by 10.68.129.34 with SMTP id nt2mr6292973pbb.18.1395768386854; Tue, 25 Mar 2014 10:26:26 -0700 (PDT) Received: from devzero2000ubu.nephoscale.com (140.195.207.67.nephoscale.net. [67.207.195.140]) by mx.google.com with ESMTPSA id x5sm47105136pbw.26.2014.03.25.10.26.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 10:26:26 -0700 (PDT) X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395768283-31135-1-git-send-email-gitter.spiros@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: The Git CodingGuidelines prefer the $( ... ) construct for command substitution instead of using the back-quotes, or grave accents (`..`). The backquoted form is the historical method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backs= lash character. Because of this the POSIX shell adopted the $(=E2=80=A6) fea= ture from the Korn shell. The patch was generated by the simple script for _f in $(find . -name "*.sh") do =C2=A0 sed -i 's@`\(.*\)`@$(\1)@g' ${_f} done Signed-off-by: Elia Pinto --- t/t7004-tag.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 143a8ea..2ed8fc0 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -23,8 +23,8 @@ test_expect_success 'listing all tags in an empty tre= e should succeed' ' ' =20 test_expect_success 'listing all tags in an empty tree should output n= othing' ' - test `git tag -l | wc -l` -eq 0 && - test `git tag | wc -l` -eq 0 + test $(git tag -l | wc -l) -eq 0 && + test $(git tag | wc -l) -eq 0 ' =20 test_expect_success 'looking for a tag in an empty tree should fail' \ @@ -60,8 +60,8 @@ test_expect_success 'listing all tags if one exists s= hould succeed' ' ' =20 test_expect_success 'listing all tags if one exists should output that= tag' ' - test `git tag -l` =3D mytag && - test `git tag` =3D mytag + test $(git tag -l) =3D mytag && + test $(git tag) =3D mytag ' =20 # pattern matching: @@ -71,7 +71,7 @@ test_expect_success 'listing a tag using a matching p= attern should succeed' \ =20 test_expect_success \ 'listing a tag using a matching pattern should output that tag' \ - 'test `git tag -l mytag` =3D mytag' + 'test $(git tag -l mytag) =3D mytag' =20 # todo: git tag -l now returns always zero, when fixed, change this te= st test_expect_success \ @@ -80,7 +80,7 @@ test_expect_success \ =20 test_expect_success \ 'listing tags using a non-matching pattern should output nothing' \ - 'test `git tag -l xxx | wc -l` -eq 0' + 'test $(git tag -l xxx | wc -l) -eq 0' =20 # special cases for creating tags: =20 @@ -90,13 +90,13 @@ test_expect_success \ =20 test_expect_success \ 'trying to create a tag with a non-valid name should fail' ' - test `git tag -l | wc -l` -eq 1 && + test $(git tag -l | wc -l) -eq 1 && test_must_fail git tag "" && test_must_fail git tag .othertag && test_must_fail git tag "other tag" && test_must_fail git tag "othertag^" && test_must_fail git tag "other~tag" && - test `git tag -l | wc -l` -eq 1 + test $(git tag -l | wc -l) -eq 1 ' =20 test_expect_success 'creating a tag using HEAD directly should succeed= ' ' --=20 1.7.10.4