From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elia Pinto Subject: [PATCH 09/10] t/t7004-tag.sh: use the $( ... ) construct for command substitution Date: Thu, 7 Jan 2016 14:51:49 +0100 Message-ID: <1452174710-28188-10-git-send-email-gitter.spiros@gmail.com> References: <1452174710-28188-1-git-send-email-gitter.spiros@gmail.com> Cc: Elia Pinto To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Thu Jan 07 14:52:30 2016 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 1aHAzH-00024f-41 for gcvg-git-2@plane.gmane.org; Thu, 07 Jan 2016 14:52:23 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752490AbcAGNwN (ORCPT ); Thu, 7 Jan 2016 08:52:13 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33943 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752241AbcAGNwD (ORCPT ); Thu, 7 Jan 2016 08:52:03 -0500 Received: by mail-pa0-f45.google.com with SMTP id uo6so241078824pac.1 for ; Thu, 07 Jan 2016 05:52:03 -0800 (PST) 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; bh=9vQuLKgMMvQvJDWLjM4PiEjD5/zPjMfVRCI4POVDXL0=; b=F7VGEyWJFN2ka+lqb6eycRHs6U+y4lQ21tsuT8SDXx1eNGldjMDFkjKBTU1RnVF4It 3gzAsTj8WEkVaOKhU+M7b0bhv1qb36/j/7M9UGLLlo2VbqkZzajxXpmNguwmKJz5wZbb Rnk7ZDeU/KfqzJvs8Xkup8F2Vk6qP/r31IqaYkIJw/B8tJmxqGkgfJazAnS0v9maNB3a a1dTzXrkRzSNGNzs9ySW2gvnfiJCd7aiFT2j0gOEy5IpZcsM/76C5x95C4jktI8nHy1s TP2mW5BepR0bfF+p96Ry0UbK3cP95cRAbn+LnBwaiokIyGgVRcpvklHs8t2/vB3H9B+d DbdQ== X-Received: by 10.66.65.203 with SMTP id z11mr151478873pas.152.1452174722986; Thu, 07 Jan 2016 05:52:02 -0800 (PST) Received: from ubuntu14.nephoscale.com (static-67.207.195.141.nephosdns.com. [67.207.195.141]) by smtp.gmail.com with ESMTPSA id kk5sm140627824pab.16.2016.01.07.05.52.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jan 2016 05:52:02 -0800 (PST) X-Mailer: git-send-email 2.3.3.GIT In-Reply-To: <1452174710-28188-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 backquotes `...`. The backquoted form is the traditional 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 backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg' "${_f}" done and then carefully proof-read. 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 3dd2f51..2797f22 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -23,8 +23,8 @@ test_expect_success 'listing all tags in an empty tree should succeed' ' ' test_expect_success 'listing all tags in an empty tree should output nothing' ' - 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 ' test_expect_success 'looking for a tag in an empty tree should fail' \ @@ -72,8 +72,8 @@ test_expect_success 'listing all tags if one exists should succeed' ' ' test_expect_success 'listing all tags if one exists should output that tag' ' - test `git tag -l` = mytag && - test `git tag` = mytag + test $(git tag -l) = mytag && + test $(git tag) = mytag ' # pattern matching: @@ -83,7 +83,7 @@ test_expect_success 'listing a tag using a matching pattern should succeed' \ test_expect_success \ 'listing a tag using a matching pattern should output that tag' \ - 'test `git tag -l mytag` = mytag' + 'test $(git tag -l mytag) = mytag' # todo: git tag -l now returns always zero, when fixed, change this test test_expect_success \ @@ -92,7 +92,7 @@ test_expect_success \ 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' # special cases for creating tags: @@ -102,13 +102,13 @@ test_expect_success \ 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 ' test_expect_success 'creating a tag using HEAD directly should succeed' ' -- 2.3.3.GIT