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
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 <redacted>
---
t/t3210-pack-refs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -27,7 +27,7 @@ SHA1= test_expect_success\'see if git show-ref works as expected'\'gitbrancha&&-SHA1=`cat.git/refs/heads/a`&&+SHA1=$(cat.git/refs/heads/a)&&echo"$SHA1 refs/heads/a">expect&&gitshow-refa>result&&test_cmpexpectresult'
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 <redacted>
---
t/t3700-add.sh | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
@@ -33,7 +33,7 @@ test_expect_success \ test_expect_success'git add: filemode=0 should not get confused by symlink''rm-fxfoo1&&test_ln_s_addfooxfoo1&&-case"`git ls-files --stage xfoo1`"in+case"$(gitls-files--stagexfoo1)"in120000" "*xfoo1)echopass;;*)echofail;gitls-files--stagexfoo1;(exit1);;esac
@@ -53,7 +53,7 @@ test_expect_success \ test_expect_success'git add: filemode=0 should not get confused by symlink''rm-fxfoo2&&test_ln_s_addfooxfoo2&&-case"`git ls-files --stage xfoo2`"in+case"$(gitls-files--stagexfoo2)"in120000" "*xfoo2)echopass;;*)echofail;gitls-files--stagexfoo2;(exit1);;esac
@@ -63,7 +63,7 @@ test_expect_success \'git update-index --add: Test that executable bit is not used...'\'gitconfigcore.filemode0&&test_ln_s_addxfoo2xfoo3&&# runs git update-index --add-case"`git ls-files --stage xfoo3`"in+case"$(gitls-files--stagexfoo3)"in120000" "*xfoo3)echopass;;*)echofail;gitls-files--stagexfoo3;(exit1);;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&&gitaddfoo&&gitcommit-a-m"commit all"&&-test-z"`git diff-index HEAD -- foo`"&&+test-z"$(gitdiff-indexHEAD--foo)"&&gitread-treeHEAD&&-case"`git diff-index HEAD -- foo`"in+case"$(gitdiff-indexHEAD--foo)"in:100644" "*"M foo")echopass;;*)echofail;(exit1);;esac&&gitadd--refresh--foo&&-test-z"`git diff-index HEAD -- foo`"+test-z"$(gitdiff-indexHEAD--foo)"' test_expect_success'git add --refresh with pathspec''
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 <redacted>
---
t/t5302-pack-index.sh | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
@@ -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=`githash-objectfile_101`&&-sha1_099=`githash-objectfile_099`&&-offs_101=`index_obj_offset1.idx$sha1_101`&&-nr_099=`index_obj_nr1.idx$sha1_099`&&+sha1_101=$(githash-objectfile_101)&&+sha1_099=$(githash-objectfile_099)&&+offs_101=$(index_obj_offset1.idx$sha1_101)&&+nr_099=$(index_obj_nr1.idx$sha1_099)&&chmod+w".git/objects/pack/pack-${pack1}.pack"&&ddof=".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=`githash-objectfile_101`&&-sha1_099=`githash-objectfile_099`&&-offs_101=`index_obj_offset1.idx$sha1_101`&&-nr_099=`index_obj_nr1.idx$sha1_099`&&+sha1_101=$(githash-objectfile_101)&&+sha1_099=$(githash-objectfile_099)&&+offs_101=$(index_obj_offset1.idx$sha1_101)&&+nr_099=$(index_obj_nr1.idx$sha1_099)&&chmod+w".git/objects/pack/pack-${pack1}.pack"&&ddof=".git/objects/pack/pack-${pack1}.pack"seek=$(($offs_101+1))\if=".git/objects/pack/pack-${pack1}.idx"\
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 <redacted>
---
t/t5301-sliding-window.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
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 <redacted>
---
t/t3600-rm.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 <redacted>
---
t/t5100-mailinfo.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
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 <redacted>
---
t/t5300-pack-object.sh | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
@@ -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)&&cattest-1-${packname_1}.pack>test-3.pack&&printf"%20s"""|ddof=test-3.idxcount=20bs=1conv=notruncseek=$l&&ifgitverify-packtest-3.pack
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 <redacted>
---
t/t3101-ls-tree-dirname.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 <redacted>
---
t/t3403-rebase-skip.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -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"$(gitdiff-treeskip-mergeskip-reference)"' test_expect_success'moved back to branch correctly''
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 <redacted>
---
t/t3511-cherry-pick-x.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
@@ -77,7 +77,7 @@ test_expect_success setup ' test_expect_success'cherry-pick -x inserts blank line after one line subject''pristine_detachinitial&&-sha1=`gitrev-parsemesg-one-line^0`&&+sha1=$(gitrev-parsemesg-one-line^0)&&gitcherry-pick-xmesg-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_detachinitial&&-sha1=`gitrev-parsemesg-no-footer^0`&&+sha1=$(gitrev-parsemesg-no-footer^0)&&gitcherry-pick-xmesg-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_detachinitial&&-sha1=`gitrev-parsemesg-no-footer^0`&&+sha1=$(gitrev-parsemesg-no-footer^0)&&gitcherry-pick-x-smesg-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_detachinitial&&-sha1=`gitrev-parsemesg-with-footer^0`&&+sha1=$(gitrev-parsemesg-with-footer^0)&&gitcherry-pick-x-smesg-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_detachinitial&&-sha1=`gitrev-parsemesg-with-footer-sob^0`&&+sha1=$(gitrev-parsemesg-with-footer-sob^0)&&gitcherry-pick-x-smesg-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_detachinitial&&-sha1=`gitrev-parsemesg-with-cherry-footer^0`&&+sha1=$(gitrev-parsemesg-with-cherry-footer^0)&&gitcherry-pick-xmesg-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_detachinitial&&-sha1=`gitrev-parsemesg-with-cherry-footer^0`&&+sha1=$(gitrev-parsemesg-with-cherry-footer^0)&&gitcherry-pick-x-smesg-with-cherry-footer&&cat<<-EOF>expect&&$mesg_with_cherry_footer
From: Johannes Sixt <hidden> Date: 2016-06-15 23:07:33
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
From: Johannes Sixt <hidden> Date: 2016-06-15 23:07:33
Am 22.12.2015 um 19:35 schrieb Johannes Sixt:
Am 22.12.2015 um 16:27 schrieb Elia Pinto:
quoted
-for mail in `echo 00*`
+for mail in $(echo 00*)
quoted
-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!