git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 00/10] use the $( ... ) construct for command substitution
@ 2015-12-22 15:27 Elia Pinto
  2015-12-22 15:27 ` [PATCH 01/10] t3101-ls-tree-dirname.sh: " Elia Pinto
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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 third serie, the other will be sent separately.


Elia Pinto (10):
  t3101-ls-tree-dirname.sh: use the $( ... ) construct for command
    substitution
  t3210-pack-refs.sh: use the $( ... ) construct for command
    substitution
  t3403-rebase-skip.sh: use the $( ... ) construct for command
    substitution
  t3511-cherry-pick-x.sh: use the $( ... ) construct for command
    substitution
  t3600-rm.sh: use the $( ... ) construct for command substitution
  t3700-add.sh: use the $( ... ) construct for command substitution
  t5100-mailinfo.sh: use the $( ... ) construct for command substitution
  t5300-pack-object.sh: use the $( ... ) construct for command
    substitution
  t5301-sliding-window.sh: use the $( ... ) construct for command
    substitution
  t5302-pack-index.sh: use the $( ... ) construct for command
    substitution

 t/t3101-ls-tree-dirname.sh |  2 +-
 t/t3210-pack-refs.sh       |  2 +-
 t/t3403-rebase-skip.sh     |  2 +-
 t/t3511-cherry-pick-x.sh   | 14 +++++++-------
 t/t3600-rm.sh              |  4 ++--
 t/t3700-add.sh             | 16 ++++++++--------
 t/t5100-mailinfo.sh        | 12 ++++++------
 t/t5300-pack-object.sh     | 18 +++++++++---------
 t/t5301-sliding-window.sh  | 14 +++++++-------
 t/t5302-pack-index.sh      | 34 +++++++++++++++++-----------------
 10 files changed, 59 insertions(+), 59 deletions(-)

-- 
2.3.3.GIT

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

* [PATCH 01/10] t3101-ls-tree-dirname.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
@ 2015-12-22 15:27 ` Elia Pinto
  2015-12-22 15:27 ` [PATCH 02/10] t3210-pack-refs.sh: " Elia Pinto
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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/t3101-ls-tree-dirname.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t3101-ls-tree-dirname.sh b/t/t3101-ls-tree-dirname.sh
index 026f9f8..425d858 100755
--- a/t/t3101-ls-tree-dirname.sh
+++ b/t/t3101-ls-tree-dirname.sh
@@ -35,7 +35,7 @@ test_expect_success 'setup' '
 	echo 222 >path3/2.txt &&
 	find *.txt path* \( -type f -o -type l \) -print |
 	xargs git update-index --add &&
-	tree=`git write-tree` &&
+	tree=$(git write-tree) &&
 	echo $tree
 '
 
-- 
2.3.3.GIT

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

* [PATCH 02/10] t3210-pack-refs.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
  2015-12-22 15:27 ` [PATCH 01/10] t3101-ls-tree-dirname.sh: " Elia Pinto
@ 2015-12-22 15:27 ` Elia Pinto
  2015-12-22 15:27 ` [PATCH 03/10] t3403-rebase-skip.sh: " Elia Pinto
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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/t3210-pack-refs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index db244d2..9b182a0 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -27,7 +27,7 @@ SHA1=
 test_expect_success \
     'see if git show-ref works as expected' \
     'git branch a &&
-     SHA1=`cat .git/refs/heads/a` &&
+     SHA1=$(cat .git/refs/heads/a) &&
      echo "$SHA1 refs/heads/a" >expect &&
      git show-ref a >result &&
      test_cmp expect result'
-- 
2.3.3.GIT

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

* [PATCH 03/10] t3403-rebase-skip.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
  2015-12-22 15:27 ` [PATCH 01/10] t3101-ls-tree-dirname.sh: " Elia Pinto
  2015-12-22 15:27 ` [PATCH 02/10] t3210-pack-refs.sh: " Elia Pinto
@ 2015-12-22 15:27 ` Elia Pinto
  2015-12-22 15:27 ` [PATCH 04/10] t3511-cherry-pick-x.sh: " Elia Pinto
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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/t3403-rebase-skip.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh
index 3968020..1f5122b 100755
--- a/t/t3403-rebase-skip.sh
+++ b/t/t3403-rebase-skip.sh
@@ -67,7 +67,7 @@ test_expect_success 'rebase --skip with --merge' '
 '
 
 test_expect_success 'merge and reference trees equal' '
-	test -z "`git diff-tree skip-merge skip-reference`"
+	test -z "$(git diff-tree skip-merge skip-reference)"
 '
 
 test_expect_success 'moved back to branch correctly' '
-- 
2.3.3.GIT

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

* [PATCH 04/10] t3511-cherry-pick-x.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (2 preceding siblings ...)
  2015-12-22 15:27 ` [PATCH 03/10] t3403-rebase-skip.sh: " Elia Pinto
@ 2015-12-22 15:27 ` Elia Pinto
  2015-12-22 15:27 ` [PATCH 05/10] t3600-rm.sh: " Elia Pinto
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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/t3511-cherry-pick-x.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh
index b7dff09..9cce5ae 100755
--- a/t/t3511-cherry-pick-x.sh
+++ b/t/t3511-cherry-pick-x.sh
@@ -77,7 +77,7 @@ test_expect_success setup '
 
 test_expect_success 'cherry-pick -x inserts blank line after one line subject' '
 	pristine_detach initial &&
-	sha1=`git rev-parse mesg-one-line^0` &&
+	sha1=$(git rev-parse mesg-one-line^0) &&
 	git cherry-pick -x mesg-one-line &&
 	cat <<-EOF >expect &&
 		$mesg_one_line
@@ -114,7 +114,7 @@ test_expect_success 'cherry-pick -s inserts blank line after non-conforming foot
 
 test_expect_success 'cherry-pick -x inserts blank line when conforming footer not found' '
 	pristine_detach initial &&
-	sha1=`git rev-parse mesg-no-footer^0` &&
+	sha1=$(git rev-parse mesg-no-footer^0) &&
 	git cherry-pick -x mesg-no-footer &&
 	cat <<-EOF >expect &&
 		$mesg_no_footer
@@ -139,7 +139,7 @@ test_expect_success 'cherry-pick -s inserts blank line when conforming footer no
 
 test_expect_success 'cherry-pick -x -s inserts blank line when conforming footer not found' '
 	pristine_detach initial &&
-	sha1=`git rev-parse mesg-no-footer^0` &&
+	sha1=$(git rev-parse mesg-no-footer^0) &&
 	git cherry-pick -x -s mesg-no-footer &&
 	cat <<-EOF >expect &&
 		$mesg_no_footer
@@ -164,7 +164,7 @@ test_expect_success 'cherry-pick -s adds sob when last sob doesnt match committe
 
 test_expect_success 'cherry-pick -x -s adds sob when last sob doesnt match committer' '
 	pristine_detach initial &&
-	sha1=`git rev-parse mesg-with-footer^0` &&
+	sha1=$(git rev-parse mesg-with-footer^0) &&
 	git cherry-pick -x -s mesg-with-footer &&
 	cat <<-EOF >expect &&
 		$mesg_with_footer
@@ -187,7 +187,7 @@ test_expect_success 'cherry-pick -s refrains from adding duplicate trailing sob'
 
 test_expect_success 'cherry-pick -x -s adds sob even when trailing sob exists for committer' '
 	pristine_detach initial &&
-	sha1=`git rev-parse mesg-with-footer-sob^0` &&
+	sha1=$(git rev-parse mesg-with-footer-sob^0) &&
 	git cherry-pick -x -s mesg-with-footer-sob &&
 	cat <<-EOF >expect &&
 		$mesg_with_footer_sob
@@ -200,7 +200,7 @@ test_expect_success 'cherry-pick -x -s adds sob even when trailing sob exists fo
 
 test_expect_success 'cherry-pick -x treats "(cherry picked from..." line as part of footer' '
 	pristine_detach initial &&
-	sha1=`git rev-parse mesg-with-cherry-footer^0` &&
+	sha1=$(git rev-parse mesg-with-cherry-footer^0) &&
 	git cherry-pick -x mesg-with-cherry-footer &&
 	cat <<-EOF >expect &&
 		$mesg_with_cherry_footer
@@ -223,7 +223,7 @@ test_expect_success 'cherry-pick -s treats "(cherry picked from..." line as part
 
 test_expect_success 'cherry-pick -x -s treats "(cherry picked from..." line as part of footer' '
 	pristine_detach initial &&
-	sha1=`git rev-parse mesg-with-cherry-footer^0` &&
+	sha1=$(git rev-parse mesg-with-cherry-footer^0) &&
 	git cherry-pick -x -s mesg-with-cherry-footer &&
 	cat <<-EOF >expect &&
 		$mesg_with_cherry_footer
-- 
2.3.3.GIT

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

* [PATCH 05/10] t3600-rm.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (3 preceding siblings ...)
  2015-12-22 15:27 ` [PATCH 04/10] t3511-cherry-pick-x.sh: " Elia Pinto
@ 2015-12-22 15:27 ` Elia Pinto
  2015-12-22 15:27 ` [PATCH 06/10] t3700-add.sh: " Elia Pinto
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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/t3600-rm.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 9d90d2c..2e47a2b 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -115,7 +115,7 @@ test_expect_success '"rm" command printed' '
 	git add test-file &&
 	git commit -m "add file for rm test" &&
 	git rm test-file > rm-output &&
-	test `grep "^rm " rm-output | wc -l` = 1 &&
+	test $(grep "^rm " rm-output | wc -l) = 1 &&
 	rm -f test-file rm-output &&
 	git commit -m "remove file from rm test"
 '
@@ -125,7 +125,7 @@ test_expect_success '"rm" command suppressed with --quiet' '
 	git add test-file &&
 	git commit -m "add file for rm --quiet test" &&
 	git rm --quiet test-file > rm-output &&
-	test `wc -l < rm-output` = 0 &&
+	test $(wc -l < rm-output) = 0 &&
 	rm -f test-file rm-output &&
 	git commit -m "remove file from rm --quiet test"
 '
-- 
2.3.3.GIT

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

* [PATCH 06/10] t3700-add.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (4 preceding siblings ...)
  2015-12-22 15:27 ` [PATCH 05/10] t3600-rm.sh: " Elia Pinto
@ 2015-12-22 15:27 ` Elia Pinto
  2015-12-22 15:27 ` [PATCH 07/10] t5100-mailinfo.sh: " Elia Pinto
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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/t3700-add.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index f7ff1f5..f14a665 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -25,7 +25,7 @@ test_expect_success \
 	 echo foo >xfoo1 &&
 	 chmod 755 xfoo1 &&
 	 git add xfoo1 &&
-	 case "`git ls-files --stage xfoo1`" in
+	 case "$(git ls-files --stage xfoo1)" in
 	 100644" "*xfoo1) echo pass;;
 	 *) echo fail; git ls-files --stage xfoo1; (exit 1);;
 	 esac'
@@ -33,7 +33,7 @@ test_expect_success \
 test_expect_success 'git add: filemode=0 should not get confused by symlink' '
 	rm -f xfoo1 &&
 	test_ln_s_add foo xfoo1 &&
-	case "`git ls-files --stage xfoo1`" in
+	case "$(git ls-files --stage xfoo1)" in
 	120000" "*xfoo1) echo pass;;
 	*) echo fail; git ls-files --stage xfoo1; (exit 1);;
 	esac
@@ -45,7 +45,7 @@ test_expect_success \
 	 echo foo >xfoo2 &&
 	 chmod 755 xfoo2 &&
 	 git update-index --add xfoo2 &&
-	 case "`git ls-files --stage xfoo2`" in
+	 case "$(git ls-files --stage xfoo2)" in
 	 100644" "*xfoo2) echo pass;;
 	 *) echo fail; git ls-files --stage xfoo2; (exit 1);;
 	 esac'
@@ -53,7 +53,7 @@ test_expect_success \
 test_expect_success 'git add: filemode=0 should not get confused by symlink' '
 	rm -f xfoo2 &&
 	test_ln_s_add foo xfoo2 &&
-	case "`git ls-files --stage xfoo2`" in
+	case "$(git ls-files --stage xfoo2)" in
 	120000" "*xfoo2) echo pass;;
 	*) echo fail; git ls-files --stage xfoo2; (exit 1);;
 	esac
@@ -63,7 +63,7 @@ test_expect_success \
 	'git update-index --add: Test that executable bit is not used...' \
 	'git config core.filemode 0 &&
 	 test_ln_s_add xfoo2 xfoo3 &&	# runs git update-index --add
-	 case "`git ls-files --stage xfoo3`" in
+	 case "$(git ls-files --stage xfoo3)" in
 	 120000" "*xfoo3) echo pass;;
 	 *) echo fail; git ls-files --stage xfoo3; (exit 1);;
 	 esac'
@@ -173,14 +173,14 @@ test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over st
 
 test_expect_success 'git add --refresh' '
 	>foo && git add foo && git commit -a -m "commit all" &&
-	test -z "`git diff-index HEAD -- foo`" &&
+	test -z "$(git diff-index HEAD -- foo)" &&
 	git read-tree HEAD &&
-	case "`git diff-index HEAD -- foo`" in
+	case "$(git diff-index HEAD -- foo)" in
 	:100644" "*"M	foo") echo pass;;
 	*) echo fail; (exit 1);;
 	esac &&
 	git add --refresh -- foo &&
-	test -z "`git diff-index HEAD -- foo`"
+	test -z "$(git diff-index HEAD -- foo)"
 '
 
 test_expect_success 'git add --refresh with pathspec' '
-- 
2.3.3.GIT

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

* [PATCH 07/10] t5100-mailinfo.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (5 preceding siblings ...)
  2015-12-22 15:27 ` [PATCH 06/10] t3700-add.sh: " Elia Pinto
@ 2015-12-22 15:27 ` Elia Pinto
  2015-12-22 18:35   ` Johannes Sixt
  2015-12-22 15:27 ` [PATCH 08/10] t5300-pack-object.sh: " Elia Pinto
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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/t5100-mailinfo.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
index e97cfb2..4e52b3b 100755
--- a/t/t5100-mailinfo.sh
+++ b/t/t5100-mailinfo.sh
@@ -9,9 +9,9 @@ test_description='git mailinfo and git mailsplit test'
 
 test_expect_success 'split sample box' \
 	'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last &&
-	last=`cat last` &&
+	last=$(cat last) &&
 	echo total is $last &&
-	test `cat last` = 17'
+	test $(cat last) = 17'
 
 check_mailinfo () {
 	mail=$1 opt=$2
@@ -23,7 +23,7 @@ check_mailinfo () {
 }
 
 
-for mail in `echo 00*`
+for mail in $(echo 00*)
 do
 	test_expect_success "mailinfo $mail" '
 		check_mailinfo $mail "" &&
@@ -47,11 +47,11 @@ test_expect_success 'split box with rfc2047 samples' \
 	'mkdir rfc2047 &&
 	git mailsplit -orfc2047 "$TEST_DIRECTORY"/t5100/rfc2047-samples.mbox \
 	  >rfc2047/last &&
-	last=`cat rfc2047/last` &&
+	last=$(cat rfc2047/last) &&
 	echo total is $last &&
-	test `cat rfc2047/last` = 11'
+	test $(cat rfc2047/last) = 11'
 
-for mail in `echo rfc2047/00*`
+for mail in $(echo rfc2047/00*)
 do
 	test_expect_success "mailinfo $mail" '
 		git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info &&
-- 
2.3.3.GIT

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

* [PATCH 08/10] t5300-pack-object.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (6 preceding siblings ...)
  2015-12-22 15:27 ` [PATCH 07/10] t5100-mailinfo.sh: " Elia Pinto
@ 2015-12-22 15:27 ` Elia Pinto
  2015-12-22 15:27 ` [PATCH 09/10] t5301-sliding-window.sh: " Elia Pinto
  2015-12-22 15:27 ` [PATCH 10/10] t5302-pack-index.sh: " Elia Pinto
  9 siblings, 0 replies; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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/t5300-pack-object.sh | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 20c1961..fc2be63 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -8,7 +8,7 @@ test_description='git pack-object
 '
 . ./test-lib.sh
 
-TRASH=`pwd`
+TRASH=$(pwd)
 
 test_expect_success \
     'setup' \
@@ -20,8 +20,8 @@ test_expect_success \
      test-genrandom "seed b" 2097152 > b_big &&
      git update-index --add a a_big b b_big c &&
      cat c >d && echo foo >>d && git update-index --add d &&
-     tree=`git write-tree` &&
-     commit=`git commit-tree $tree </dev/null` && {
+     tree=$(git write-tree) &&
+     commit=$(git commit-tree $tree </dev/null) && {
 	 echo $tree &&
 	 echo $commit &&
 	 git ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\)	.*/\\1/"
@@ -29,7 +29,7 @@ test_expect_success \
 	 git diff-tree --root -p $commit &&
 	 while read object
 	 do
-	    t=`git cat-file -t $object` &&
+	    t=$(git cat-file -t $object) &&
 	    git cat-file $t $object || return 1
 	 done <obj-list
      } >expect'
@@ -147,7 +147,7 @@ test_expect_success \
 	 git diff-tree --root -p $commit &&
 	 while read object
 	 do
-	    t=`git cat-file -t $object` &&
+	    t=$(git cat-file -t $object) &&
 	    git cat-file $t $object || return 1
 	 done <obj-list
     } >current &&
@@ -162,7 +162,7 @@ test_expect_success \
 	 git diff-tree --root -p $commit &&
 	 while read object
 	 do
-	    t=`git cat-file -t $object` &&
+	    t=$(git cat-file -t $object) &&
 	    git cat-file $t $object || return 1
 	 done <obj-list
     } >current &&
@@ -177,7 +177,7 @@ test_expect_success \
 	 git diff-tree --root -p $commit &&
 	 while read object
 	 do
-	    t=`git cat-file -t $object` &&
+	    t=$(git cat-file -t $object) &&
 	    git cat-file $t $object || return 1
 	 done <obj-list
     } >current &&
@@ -252,8 +252,8 @@ test_expect_success \
 
 test_expect_success \
     'verify-pack catches a corrupted sum of the index file itself' \
-    'l=`wc -c <test-3.idx` &&
-     l=`expr $l - 20` &&
+    'l=$(wc -c <test-3.idx) &&
+     l=$(expr $l - 20) &&
      cat test-1-${packname_1}.pack >test-3.pack &&
      printf "%20s" "" | dd of=test-3.idx count=20 bs=1 conv=notrunc seek=$l &&
      if git verify-pack test-3.pack
-- 
2.3.3.GIT

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

* [PATCH 09/10] t5301-sliding-window.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (7 preceding siblings ...)
  2015-12-22 15:27 ` [PATCH 08/10] t5300-pack-object.sh: " Elia Pinto
@ 2015-12-22 15:27 ` Elia Pinto
  2015-12-22 15:27 ` [PATCH 10/10] t5302-pack-index.sh: " Elia Pinto
  9 siblings, 0 replies; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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/t5301-sliding-window.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh
index 2fc5af6..cae8c2e 100755
--- a/t/t5301-sliding-window.sh
+++ b/t/t5301-sliding-window.sh
@@ -16,12 +16,12 @@ test_expect_success \
          git update-index --add $i || return 1
      done &&
      echo d >d && cat c >>d && git update-index --add d &&
-     tree=`git write-tree` &&
-     commit1=`git commit-tree $tree </dev/null` &&
+     tree=$(git write-tree) &&
+     commit1=$(git commit-tree $tree </dev/null) &&
      git update-ref HEAD $commit1 &&
      git repack -a -d &&
-     test "`git count-objects`" = "0 objects, 0 kilobytes" &&
-     pack1=`ls .git/objects/pack/*.pack` &&
+     test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
+     pack1=$(ls .git/objects/pack/*.pack) &&
      test -f "$pack1"'
 
 test_expect_success \
@@ -43,11 +43,11 @@ test_expect_success \
     'repack -a -d, packedGit{WindowSize,Limit} == 1 page' \
     'git config core.packedGitWindowSize 512 &&
      git config core.packedGitLimit 512 &&
-     commit2=`git commit-tree $tree -p $commit1 </dev/null` &&
+     commit2=$(git commit-tree $tree -p $commit1 </dev/null) &&
      git update-ref HEAD $commit2 &&
      git repack -a -d &&
-     test "`git count-objects`" = "0 objects, 0 kilobytes" &&
-     pack2=`ls .git/objects/pack/*.pack` &&
+     test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
+     pack2=$(ls .git/objects/pack/*.pack) &&
      test -f "$pack2" &&
      test "$pack1" \!= "$pack2"'
 
-- 
2.3.3.GIT

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

* [PATCH 10/10] t5302-pack-index.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
                   ` (8 preceding siblings ...)
  2015-12-22 15:27 ` [PATCH 09/10] t5301-sliding-window.sh: " Elia Pinto
@ 2015-12-22 15:27 ` Elia Pinto
  9 siblings, 0 replies; 16+ messages in thread
From: Elia Pinto @ 2015-12-22 15:27 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/t5302-pack-index.sh | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index 3dc5ec4..c2fc584 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -14,21 +14,21 @@ test_expect_success \
      i=1 &&
      while test $i -le 100
      do
-         iii=`printf '%03i' $i`
+         iii=$(printf '%03i' $i)
          test-genrandom "bar" 200 > wide_delta_$iii &&
          test-genrandom "baz $iii" 50 >> wide_delta_$iii &&
          test-genrandom "foo"$i 100 > deep_delta_$iii &&
-         test-genrandom "foo"`expr $i + 1` 100 >> deep_delta_$iii &&
-         test-genrandom "foo"`expr $i + 2` 100 >> deep_delta_$iii &&
+         test-genrandom "foo"$(expr $i + 1) 100 >> deep_delta_$iii &&
+         test-genrandom "foo"$(expr $i + 2) 100 >> deep_delta_$iii &&
          echo $iii >file_$iii &&
          test-genrandom "$iii" 8192 >>file_$iii &&
          git update-index --add file_$iii deep_delta_$iii wide_delta_$iii &&
-         i=`expr $i + 1` || return 1
+         i=$(expr $i + 1) || return 1
      done &&
      { echo 101 && test-genrandom 100 8192; } >file_101 &&
      git update-index --add file_101 &&
-     tree=`git write-tree` &&
-     commit=`git commit-tree $tree </dev/null` && {
+     tree=$(git write-tree) &&
+     commit=$(git commit-tree $tree </dev/null) && {
 	 echo $tree &&
 	 git ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\)	.*/\\1/"
      } >obj-list &&
@@ -152,10 +152,10 @@ test_expect_success \
     '[index v1] 2) create a stealth corruption in a delta base reference' \
     '# This test assumes file_101 is a delta smaller than 16 bytes.
      # It should be against file_100 but we substitute its base for file_099
-     sha1_101=`git hash-object file_101` &&
-     sha1_099=`git hash-object file_099` &&
-     offs_101=`index_obj_offset 1.idx $sha1_101` &&
-     nr_099=`index_obj_nr 1.idx $sha1_099` &&
+     sha1_101=$(git hash-object file_101) &&
+     sha1_099=$(git hash-object file_099) &&
+     offs_101=$(index_obj_offset 1.idx $sha1_101) &&
+     nr_099=$(index_obj_nr 1.idx $sha1_099) &&
      chmod +w ".git/objects/pack/pack-${pack1}.pack" &&
      dd of=".git/objects/pack/pack-${pack1}.pack" seek=$(($offs_101 + 1)) \
         if=".git/objects/pack/pack-${pack1}.idx" \
@@ -193,10 +193,10 @@ test_expect_success \
     '[index v2] 2) create a stealth corruption in a delta base reference' \
     '# This test assumes file_101 is a delta smaller than 16 bytes.
      # It should be against file_100 but we substitute its base for file_099
-     sha1_101=`git hash-object file_101` &&
-     sha1_099=`git hash-object file_099` &&
-     offs_101=`index_obj_offset 1.idx $sha1_101` &&
-     nr_099=`index_obj_nr 1.idx $sha1_099` &&
+     sha1_101=$(git hash-object file_101) &&
+     sha1_099=$(git hash-object file_099) &&
+     offs_101=$(index_obj_offset 1.idx $sha1_101) &&
+     nr_099=$(index_obj_nr 1.idx $sha1_099) &&
      chmod +w ".git/objects/pack/pack-${pack1}.pack" &&
      dd of=".git/objects/pack/pack-${pack1}.pack" seek=$(($offs_101 + 1)) \
         if=".git/objects/pack/pack-${pack1}.idx" \
@@ -222,11 +222,11 @@ test_expect_success \
     'rm -f .git/objects/pack/* &&
      git index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" &&
      git verify-pack ".git/objects/pack/pack-${pack1}.pack" &&
-     obj=`git hash-object file_001` &&
-     nr=`index_obj_nr ".git/objects/pack/pack-${pack1}.idx" $obj` &&
+     obj=$(git hash-object file_001) &&
+     nr=$(index_obj_nr ".git/objects/pack/pack-${pack1}.idx" $obj) &&
      chmod +w ".git/objects/pack/pack-${pack1}.idx" &&
      printf xxxx | dd of=".git/objects/pack/pack-${pack1}.idx" conv=notrunc \
-        bs=1 count=4 seek=$((8 + 256 * 4 + `wc -l <obj-list` * 20 + $nr * 4)) &&
+        bs=1 count=4 seek=$((8 + 256 * 4 + $(wc -l <obj-list) * 20 + $nr * 4)) &&
      ( while read obj
        do git cat-file -p $obj >/dev/null || exit 1
        done <obj-list ) &&
-- 
2.3.3.GIT

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

* Re: [PATCH 07/10] t5100-mailinfo.sh: use the $( ... ) construct for command substitution
  2015-12-22 15:27 ` [PATCH 07/10] t5100-mailinfo.sh: " Elia Pinto
@ 2015-12-22 18:35   ` Johannes Sixt
  2015-12-22 20:34     ` Johannes Sixt
  0 siblings, 1 reply; 16+ messages in thread
From: Johannes Sixt @ 2015-12-22 18:35 UTC (permalink / raw)
  To: Elia Pinto, git

Am 22.12.2015 um 16:27 schrieb Elia Pinto:
> -for mail in `echo 00*`
> +for mail in $(echo 00*)

> -for mail in `echo rfc2047/00*`
> +for mail in $(echo rfc2047/00*)

True, these are equvalence transformations. But a better way to get rid 
of the back-quotes is to write these lines as

for mail in echo 00*
for mail in echo rfc2047/00*

No?

-- Hannes

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

* Re: [PATCH 07/10] t5100-mailinfo.sh: use the $( ... ) construct for command substitution
  2015-12-22 18:35   ` Johannes Sixt
@ 2015-12-22 20:34     ` Johannes Sixt
  2015-12-27 23:46       ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Johannes Sixt @ 2015-12-22 20:34 UTC (permalink / raw)
  To: Elia Pinto, git

Am 22.12.2015 um 19:35 schrieb Johannes Sixt:
> Am 22.12.2015 um 16:27 schrieb Elia Pinto:
>> -for mail in `echo 00*`
>> +for mail in $(echo 00*)
>
>> -for mail in `echo rfc2047/00*`
>> +for mail in $(echo rfc2047/00*)
>
> True, these are equvalence transformations. But a better way to get rid
> of the back-quotes is to write these lines as
>
> for mail in echo 00*
> for mail in echo rfc2047/00*

Ahem... both of these lines without the 'echo', of course!

>
> No?
>
> -- Hannes
>

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

* Re: [PATCH 07/10] t5100-mailinfo.sh: use the $( ... ) construct for command substitution
  2015-12-22 20:34     ` Johannes Sixt
@ 2015-12-27 23:46       ` Junio C Hamano
  2015-12-28  1:59         ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2015-12-27 23:46 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Elia Pinto, git

Johannes Sixt <j6t@kdbg.org> writes:

> Am 22.12.2015 um 19:35 schrieb Johannes Sixt:
>> Am 22.12.2015 um 16:27 schrieb Elia Pinto:
>>> -for mail in `echo 00*`
>>> +for mail in $(echo 00*)
>>
>>> -for mail in `echo rfc2047/00*`
>>> +for mail in $(echo rfc2047/00*)
>>
>> True, these are equvalence transformations. But a better way to get rid
>> of the back-quotes is to write these lines as
>>
>> for mail in echo 00*
>> for mail in echo rfc2047/00*
>
> Ahem... both of these lines without the 'echo', of course!

Very true.  Let's leave that kind of things as separate clean-ups
after these patches settle, as mixing manual and mechanical changes
in a single patch makes it harder to review.

Thanks.

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

* Re: [PATCH 07/10] t5100-mailinfo.sh: use the $( ... ) construct for command substitution
  2015-12-27 23:46       ` Junio C Hamano
@ 2015-12-28  1:59         ` Junio C Hamano
  2015-12-28  7:44           ` Johannes Sixt
  0 siblings, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2015-12-28  1:59 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Elia Pinto, git

Junio C Hamano <gitster@pobox.com> writes:

> Very true.  Let's leave that kind of things as separate clean-ups
> after these patches settle, as mixing manual and mechanical changes
> in a single patch makes it harder to review.
>
> Thanks.

So that I won't forget (I'll need to amend with your sign-off even
if this one is satisfactory to you).

-- >8 --
From: Johannes Sixt <j6t@kdbg.org>
Date: Tue, 22 Dec 2015 19:35:16 +0100
Subject: [PATCH] t5100: no need to use 'echo' command substitutions for globbing

Instead of making the shell expand 00* and invoke 'echo' with it,
and then capturing its output as command substitution, just use
the result of expanding 00* directly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t5100-mailinfo.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
index 4e52b3b..85b3df5 100755
--- a/t/t5100-mailinfo.sh
+++ b/t/t5100-mailinfo.sh
@@ -23,7 +23,7 @@ check_mailinfo () {
 }
 
 
-for mail in $(echo 00*)
+for mail in 00*
 do
 	test_expect_success "mailinfo $mail" '
 		check_mailinfo $mail "" &&
@@ -51,7 +51,7 @@ test_expect_success 'split box with rfc2047 samples' \
 	echo total is $last &&
 	test $(cat rfc2047/last) = 11'
 
-for mail in $(echo rfc2047/00*)
+for mail in rfc2047/00*
 do
 	test_expect_success "mailinfo $mail" '
 		git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info &&
-- 
2.7.0-rc2-145-g5695473

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

* Re: [PATCH 07/10] t5100-mailinfo.sh: use the $( ... ) construct for command substitution
  2015-12-28  1:59         ` Junio C Hamano
@ 2015-12-28  7:44           ` Johannes Sixt
  0 siblings, 0 replies; 16+ messages in thread
From: Johannes Sixt @ 2015-12-28  7:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Elia Pinto, git

Am 28.12.2015 um 02:59 schrieb Junio C Hamano:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Very true.  Let's leave that kind of things as separate clean-ups
>> after these patches settle, as mixing manual and mechanical changes
>> in a single patch makes it harder to review.
>>
>> Thanks.
>
> So that I won't forget (I'll need to amend with your sign-off even
> if this one is satisfactory to you).
>
> -- >8 --
> From: Johannes Sixt <j6t@kdbg.org>
> Date: Tue, 22 Dec 2015 19:35:16 +0100
> Subject: [PATCH] t5100: no need to use 'echo' command substitutions for globbing
>
> Instead of making the shell expand 00* and invoke 'echo' with it,
> and then capturing its output as command substitution, just use
> the result of expanding 00* directly.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>   t/t5100-mailinfo.sh | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
> index 4e52b3b..85b3df5 100755
> --- a/t/t5100-mailinfo.sh
> +++ b/t/t5100-mailinfo.sh
> @@ -23,7 +23,7 @@ check_mailinfo () {
>   }
>
>
> -for mail in $(echo 00*)
> +for mail in 00*
>   do
>   	test_expect_success "mailinfo $mail" '
>   		check_mailinfo $mail "" &&
> @@ -51,7 +51,7 @@ test_expect_success 'split box with rfc2047 samples' \
>   	echo total is $last &&
>   	test $(cat rfc2047/last) = 11'
>
> -for mail in $(echo rfc2047/00*)
> +for mail in rfc2047/00*
>   do
>   	test_expect_success "mailinfo $mail" '
>   		git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info &&
>

Signed-off-by: Johannes Sixt <j6t@kdbg.org>

Thank you for making a proper patch!

-- Hannes

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

end of thread, other threads:[~2015-12-28  7:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-22 15:27 [PATCH 00/10] use the $( ... ) construct for command substitution Elia Pinto
2015-12-22 15:27 ` [PATCH 01/10] t3101-ls-tree-dirname.sh: " Elia Pinto
2015-12-22 15:27 ` [PATCH 02/10] t3210-pack-refs.sh: " Elia Pinto
2015-12-22 15:27 ` [PATCH 03/10] t3403-rebase-skip.sh: " Elia Pinto
2015-12-22 15:27 ` [PATCH 04/10] t3511-cherry-pick-x.sh: " Elia Pinto
2015-12-22 15:27 ` [PATCH 05/10] t3600-rm.sh: " Elia Pinto
2015-12-22 15:27 ` [PATCH 06/10] t3700-add.sh: " Elia Pinto
2015-12-22 15:27 ` [PATCH 07/10] t5100-mailinfo.sh: " Elia Pinto
2015-12-22 18:35   ` Johannes Sixt
2015-12-22 20:34     ` Johannes Sixt
2015-12-27 23:46       ` Junio C Hamano
2015-12-28  1:59         ` Junio C Hamano
2015-12-28  7:44           ` Johannes Sixt
2015-12-22 15:27 ` [PATCH 08/10] t5300-pack-object.sh: " Elia Pinto
2015-12-22 15:27 ` [PATCH 09/10] t5301-sliding-window.sh: " Elia Pinto
2015-12-22 15:27 ` [PATCH 10/10] t5302-pack-index.sh: " Elia Pinto

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).