git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] use the $( ... ) construct for command substitution
@ 2016-01-07 13:51 Elia Pinto
  2016-01-07 13:51 ` [PATCH 01/10] t/t5900-repo-selection.sh: " Elia Pinto
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

This patch series continues the changes introduced with the merge
6753d8a85d543253d95184ec2faad6dc197f248:

    Merge branch 'ep/shell-command-substitution'

    Adjust shell scripts to use $(cmd) instead of `cmd`.


This is the  sixth  series, the other will be sent separately.

Elia Pinto (10):
  t/t5900-repo-selection.sh: use the $( ... ) construct for command
    substitution
  t/t6001-rev-list-graft.sh: use the $( ... ) construct for command
    substitution
  t/t6002-rev-list-bisect.sh: use the $( ... ) construct for command
    substitution
  t/t6015-rev-list-show-all-parents.sh: use the $( ... ) construct for
    command substitution
  t/t6032-merge-large-rename.sh: use the $( ... ) construct for command
    substitution
  t/t6132-pathspec-exclude.sh: use the $( ... ) construct for command
    substitution
  t/t7001-mv.sh: use the $( ... ) construct for command substitution
  t/t7003-filter-branch.sh: use the $( ... ) construct for command
    substitution
  t/t7004-tag.sh: use the $( ... ) construct for command substitution
  t/t7006-pager.sh: use the $( ... ) construct for command substitution

 t/t5900-repo-selection.sh            |  2 +-
 t/t6001-rev-list-graft.sh            | 12 ++++++------
 t/t6002-rev-list-bisect.sh           |  6 +++---
 t/t6015-rev-list-show-all-parents.sh |  6 +++---
 t/t6032-merge-large-rename.sh        |  2 +-
 t/t6132-pathspec-exclude.sh          |  2 +-
 t/t7001-mv.sh                        |  4 ++--
 t/t7003-filter-branch.sh             |  6 +++---
 t/t7004-tag.sh                       | 16 ++++++++--------
 t/t7006-pager.sh                     |  2 +-
 10 files changed, 29 insertions(+), 29 deletions(-)

-- 
2.3.3.GIT

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 01/10] t/t5900-repo-selection.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
@ 2016-01-07 13:51 ` Elia Pinto
  2016-01-07 13:51 ` [PATCH 02/10] t/t6001-rev-list-graft.sh: " Elia Pinto
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

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 <gitter.spiros@gmail.com>
---
 t/t5900-repo-selection.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t5900-repo-selection.sh b/t/t5900-repo-selection.sh
index 3d5b418..14e59c5 100755
--- a/t/t5900-repo-selection.sh
+++ b/t/t5900-repo-selection.sh
@@ -15,7 +15,7 @@ make_tree() {
 make_bare() {
 	git init --bare "$1" &&
 	(cd "$1" &&
-	 tree=`git hash-object -w -t tree /dev/null` &&
+	 tree=$(git hash-object -w -t tree /dev/null) &&
 	 commit=$(echo "$1" | git commit-tree $tree) &&
 	 git update-ref HEAD $commit
 	)
-- 
2.3.3.GIT

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 02/10] t/t6001-rev-list-graft.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
  2016-01-07 13:51 ` [PATCH 01/10] t/t5900-repo-selection.sh: " Elia Pinto
@ 2016-01-07 13:51 ` Elia Pinto
  2016-01-07 13:51 ` [PATCH 03/10] t/t6002-rev-list-bisect.sh: " Elia Pinto
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

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 <gitter.spiros@gmail.com>
---
 t/t6001-rev-list-graft.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/t/t6001-rev-list-graft.sh b/t/t6001-rev-list-graft.sh
index 8efcd13..05ddc69 100755
--- a/t/t6001-rev-list-graft.sh
+++ b/t/t6001-rev-list-graft.sh
@@ -10,15 +10,15 @@ test_expect_success setup '
 	echo >subdir/fileB fileB &&
 	git add fileA subdir/fileB &&
 	git commit -a -m "Initial in one history." &&
-	A0=`git rev-parse --verify HEAD` &&
+	A0=$(git rev-parse --verify HEAD) &&
 
 	echo >fileA fileA modified &&
 	git commit -a -m "Second in one history." &&
-	A1=`git rev-parse --verify HEAD` &&
+	A1=$(git rev-parse --verify HEAD) &&
 
 	echo >subdir/fileB fileB modified &&
 	git commit -a -m "Third in one history." &&
-	A2=`git rev-parse --verify HEAD` &&
+	A2=$(git rev-parse --verify HEAD) &&
 
 	rm -f .git/refs/heads/master .git/index &&
 
@@ -26,15 +26,15 @@ test_expect_success setup '
 	echo >subdir/fileB fileB again &&
 	git add fileA subdir/fileB &&
 	git commit -a -m "Initial in alternate history." &&
-	B0=`git rev-parse --verify HEAD` &&
+	B0=$(git rev-parse --verify HEAD) &&
 
 	echo >fileA fileA modified in alternate history &&
 	git commit -a -m "Second in alternate history." &&
-	B1=`git rev-parse --verify HEAD` &&
+	B1=$(git rev-parse --verify HEAD) &&
 
 	echo >subdir/fileB fileB modified in alternate history &&
 	git commit -a -m "Third in alternate history." &&
-	B2=`git rev-parse --verify HEAD` &&
+	B2=$(git rev-parse --verify HEAD) &&
 	: done
 '
 
-- 
2.3.3.GIT

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 03/10] t/t6002-rev-list-bisect.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
  2016-01-07 13:51 ` [PATCH 01/10] t/t5900-repo-selection.sh: " Elia Pinto
  2016-01-07 13:51 ` [PATCH 02/10] t/t6001-rev-list-graft.sh: " Elia Pinto
@ 2016-01-07 13:51 ` Elia Pinto
  2016-01-07 13:51 ` [PATCH 04/10] t/t6015-rev-list-show-all-parents.sh: " Elia Pinto
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

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 <gitter.spiros@gmail.com>
---
 t/t6002-rev-list-bisect.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh
index 43ad772..3bf2759 100755
--- a/t/t6002-rev-list-bisect.sh
+++ b/t/t6002-rev-list-bisect.sh
@@ -27,9 +27,9 @@ test_bisection_diff()
 	# Test if bisection size is close to half of list size within
 	# tolerance.
 	#
-	_bisect_err=`expr $_list_size - $_bisection_size \* 2`
-	test "$_bisect_err" -lt 0 && _bisect_err=`expr 0 - $_bisect_err`
-	_bisect_err=`expr $_bisect_err / 2` ; # floor
+	_bisect_err=$(expr $_list_size - $_bisection_size \* 2)
+	test "$_bisect_err" -lt 0 && _bisect_err=$(expr 0 - $_bisect_err)
+	_bisect_err=$(expr $_bisect_err / 2) ; # floor
 
 	test_expect_success \
 	"bisection diff $_bisect_option $_head $* <= $_max_diff" \
-- 
2.3.3.GIT

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 04/10] t/t6015-rev-list-show-all-parents.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (2 preceding siblings ...)
  2016-01-07 13:51 ` [PATCH 03/10] t/t6002-rev-list-bisect.sh: " Elia Pinto
@ 2016-01-07 13:51 ` Elia Pinto
  2016-01-07 13:51 ` [PATCH 05/10] t/t6032-merge-large-rename.sh: " Elia Pinto
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

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 <gitter.spiros@gmail.com>
---
 t/t6015-rev-list-show-all-parents.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t6015-rev-list-show-all-parents.sh b/t/t6015-rev-list-show-all-parents.sh
index 8b146fb..3c73c93 100755
--- a/t/t6015-rev-list-show-all-parents.sh
+++ b/t/t6015-rev-list-show-all-parents.sh
@@ -6,11 +6,11 @@ test_description='--show-all --parents does not rewrite TREESAME commits'
 
 test_expect_success 'set up --show-all --parents test' '
 	test_commit one foo.txt &&
-	commit1=`git rev-list -1 HEAD` &&
+	commit1=$(git rev-list -1 HEAD) &&
 	test_commit two bar.txt &&
-	commit2=`git rev-list -1 HEAD` &&
+	commit2=$(git rev-list -1 HEAD) &&
 	test_commit three foo.txt &&
-	commit3=`git rev-list -1 HEAD`
+	commit3=$(git rev-list -1 HEAD)
 	'
 
 test_expect_success '--parents rewrites TREESAME parents correctly' '
-- 
2.3.3.GIT

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 05/10] t/t6032-merge-large-rename.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (3 preceding siblings ...)
  2016-01-07 13:51 ` [PATCH 04/10] t/t6015-rev-list-show-all-parents.sh: " Elia Pinto
@ 2016-01-07 13:51 ` Elia Pinto
  2016-01-07 13:51 ` [PATCH 06/10] t/t6132-pathspec-exclude.sh: " Elia Pinto
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

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 <gitter.spiros@gmail.com>
---
 t/t6032-merge-large-rename.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t6032-merge-large-rename.sh b/t/t6032-merge-large-rename.sh
index 0f79268..8077738 100755
--- a/t/t6032-merge-large-rename.sh
+++ b/t/t6032-merge-large-rename.sh
@@ -20,7 +20,7 @@ test_expect_success 'setup (initial)' '
 
 make_text() {
 	echo $1: $2
-	for i in `count 20`; do
+	for i in $(count 20); do
 		echo $1: $i
 	done
 	echo $1: $3
-- 
2.3.3.GIT

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 06/10] t/t6132-pathspec-exclude.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (4 preceding siblings ...)
  2016-01-07 13:51 ` [PATCH 05/10] t/t6032-merge-large-rename.sh: " Elia Pinto
@ 2016-01-07 13:51 ` Elia Pinto
  2016-01-07 13:51 ` [PATCH 07/10] t/t7001-mv.sh: " Elia Pinto
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

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 <gitter.spiros@gmail.com>
---
 t/t6132-pathspec-exclude.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t6132-pathspec-exclude.sh b/t/t6132-pathspec-exclude.sh
index e1e1b1f..d51595c 100755
--- a/t/t6132-pathspec-exclude.sh
+++ b/t/t6132-pathspec-exclude.sh
@@ -7,7 +7,7 @@ test_description='test case exclude pathspec'
 test_expect_success 'setup' '
 	for p in file sub/file sub/sub/file sub/file2 sub/sub/sub/file sub2/file; do
 		if echo $p | grep /; then
-			mkdir -p `dirname $p`
+			mkdir -p $(dirname $p)
 		fi &&
 		: >$p &&
 		git add $p &&
-- 
2.3.3.GIT

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 07/10] t/t7001-mv.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (5 preceding siblings ...)
  2016-01-07 13:51 ` [PATCH 06/10] t/t6132-pathspec-exclude.sh: " Elia Pinto
@ 2016-01-07 13:51 ` Elia Pinto
  2016-01-07 13:51 ` [PATCH 08/10] t/t7003-filter-branch.sh: " Elia Pinto
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

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 <gitter.spiros@gmail.com>
---
 t/t7001-mv.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 7b56081..51dd2b4 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -156,11 +156,11 @@ test_expect_success "Michael Cassar's test case" '
 	echo b > partA/outline.txt &&
 	echo c > papers/unsorted/_another &&
 	git add papers partA &&
-	T1=`git write-tree` &&
+	T1=$(git write-tree) &&
 
 	git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf &&
 
-	T=`git write-tree` &&
+	T=$(git write-tree) &&
 	git ls-tree -r $T | verbose grep partA/outline.txt
 '
 
-- 
2.3.3.GIT

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 08/10] t/t7003-filter-branch.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (6 preceding siblings ...)
  2016-01-07 13:51 ` [PATCH 07/10] t/t7001-mv.sh: " Elia Pinto
@ 2016-01-07 13:51 ` Elia Pinto
  2016-01-07 13:51 ` [PATCH 09/10] t/t7004-tag.sh: " Elia Pinto
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

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 <gitter.spiros@gmail.com>
---
 t/t7003-filter-branch.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 869e0bf..8868e6e 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -387,7 +387,7 @@ test_expect_success 'setup submodule' '
 	git branch original HEAD
 '
 
-orig_head=`git show-ref --hash --head HEAD`
+orig_head=$(git show-ref --hash --head HEAD)
 
 test_expect_success 'rewrite submodule with another content' '
 	git filter-branch --tree-filter "test -d submod && {
@@ -396,7 +396,7 @@ test_expect_success 'rewrite submodule with another content' '
 					 mkdir submod &&
 					 : > submod/file
 					 } || :" HEAD &&
-	test $orig_head != `git show-ref --hash --head HEAD`
+	test $orig_head != $(git show-ref --hash --head HEAD)
 '
 
 test_expect_success 'replace submodule revision' '
@@ -405,7 +405,7 @@ test_expect_success 'replace submodule revision' '
 	    "if git ls-files --error-unmatch -- submod > /dev/null 2>&1
 	     then git update-index --cacheinfo 160000 0123456789012345678901234567890123456789 submod
 	     fi" HEAD &&
-	test $orig_head != `git show-ref --hash --head HEAD`
+	test $orig_head != $(git show-ref --hash --head HEAD)
 '
 
 test_expect_success 'filter commit message without trailing newline' '
-- 
2.3.3.GIT

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 09/10] t/t7004-tag.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (7 preceding siblings ...)
  2016-01-07 13:51 ` [PATCH 08/10] t/t7003-filter-branch.sh: " Elia Pinto
@ 2016-01-07 13:51 ` Elia Pinto
  2016-01-07 13:51 ` [PATCH 10/10] t/t7006-pager.sh: " Elia Pinto
  2016-01-07 22:00 ` [PATCH 00/10] " Junio C Hamano
  10 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

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 <gitter.spiros@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 10/10] t/t7006-pager.sh: use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (8 preceding siblings ...)
  2016-01-07 13:51 ` [PATCH 09/10] t/t7004-tag.sh: " Elia Pinto
@ 2016-01-07 13:51 ` Elia Pinto
  2016-01-07 22:00 ` [PATCH 00/10] " Junio C Hamano
  10 siblings, 0 replies; 12+ messages in thread
From: Elia Pinto @ 2016-01-07 13:51 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

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 <gitter.spiros@gmail.com>
---
 t/t7006-pager.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 6ea7ac4..e4fc5c8 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -424,7 +424,7 @@ test_expect_success TTY 'command-specific pager works for external commands' '
 	echo "foo:initial" >expect &&
 	>actual &&
 	test_config pager.external "sed s/^/foo:/ >actual" &&
-	test_terminal git --exec-path="`pwd`" external log --format=%s -1 &&
+	test_terminal git --exec-path="$(pwd)" external log --format=%s -1 &&
 	test_cmp expect actual
 '
 
-- 
2.3.3.GIT

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 00/10] use the $( ... ) construct for command substitution
  2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (9 preceding siblings ...)
  2016-01-07 13:51 ` [PATCH 10/10] t/t7006-pager.sh: " Elia Pinto
@ 2016-01-07 22:00 ` Junio C Hamano
  10 siblings, 0 replies; 12+ messages in thread
From: Junio C Hamano @ 2016-01-07 22:00 UTC (permalink / raw)
  To: Elia Pinto; +Cc: Git Mailing List

All looked trivially correct. Thanks, will queue.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-01-07 22:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-07 13:51 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
2016-01-07 13:51 ` [PATCH 01/10] t/t5900-repo-selection.sh: " Elia Pinto
2016-01-07 13:51 ` [PATCH 02/10] t/t6001-rev-list-graft.sh: " Elia Pinto
2016-01-07 13:51 ` [PATCH 03/10] t/t6002-rev-list-bisect.sh: " Elia Pinto
2016-01-07 13:51 ` [PATCH 04/10] t/t6015-rev-list-show-all-parents.sh: " Elia Pinto
2016-01-07 13:51 ` [PATCH 05/10] t/t6032-merge-large-rename.sh: " Elia Pinto
2016-01-07 13:51 ` [PATCH 06/10] t/t6132-pathspec-exclude.sh: " Elia Pinto
2016-01-07 13:51 ` [PATCH 07/10] t/t7001-mv.sh: " Elia Pinto
2016-01-07 13:51 ` [PATCH 08/10] t/t7003-filter-branch.sh: " Elia Pinto
2016-01-07 13:51 ` [PATCH 09/10] t/t7004-tag.sh: " Elia Pinto
2016-01-07 13:51 ` [PATCH 10/10] t/t7006-pager.sh: " Elia Pinto
2016-01-07 22:00 ` [PATCH 00/10] " Junio C Hamano

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).