t9300-fast-import.sh: use the $( ... ) construct for command substitution

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elia Pinto committed Jan 12, 2016 at 11:49 UTC 80a6b3f0d54d0df6c6994df5486433bf0b9a54c0
1 file changed +34 -34
t/t9300-fast-import.sh
+34 -34
@@ -171,10 +171,10 @@ test_expect_success 'A: verify tag/series-A-blob' '
171
172 test_expect_success 'A: verify marks output' '
173 cat >expect <<-EOF &&
174 - :2 `git rev-parse --verify master:file2`
175 - :3 `git rev-parse --verify master:file3`
176 - :4 `git rev-parse --verify master:file4`
177 - :5 `git rev-parse --verify master^0`
174 + :2 $(git rev-parse --verify master:file2)
175 + :3 $(git rev-parse --verify master:file3)
176 + :4 $(git rev-parse --verify master:file4)
177 + :5 $(git rev-parse --verify master^0)
178 EOF
179 test_cmp expect marks.out
180 '
@@ -264,8 +264,8 @@ test_expect_success 'A: verify diff' '
264 EOF
265 git diff-tree -M -r master verify--import-marks >actual &&
266 compare_diff_raw expect actual &&
267 - test `git rev-parse --verify master:file2` \
268 - = `git rev-parse --verify verify--import-marks:copy-of-file2`
267 + test $(git rev-parse --verify master:file2) \
268 + = $(git rev-parse --verify verify--import-marks:copy-of-file2)
269 '
270
271 test_expect_success 'A: export marks with large values' '
@@ -364,7 +364,7 @@ test_expect_success 'B: accept branch name "TEMP_TAG"' '
364 git prune" &&
365 git fast-import <input &&
366 test -f .git/TEMP_TAG &&
367 - test `git rev-parse master` = `git rev-parse TEMP_TAG^`
367 + test $(git rev-parse master) = $(git rev-parse TEMP_TAG^)
368 '
369
370 test_expect_success 'B: accept empty committer' '
@@ -473,8 +473,8 @@ test_expect_success 'B: fail on invalid committer (5)' '
473 ###
474
475 test_expect_success 'C: incremental import create pack from stdin' '
476 - newf=`echo hi newf | git hash-object -w --stdin` &&
477 - oldf=`git rev-parse --verify master:file2` &&
476 + newf=$(echo hi newf | git hash-object -w --stdin) &&
477 + oldf=$(git rev-parse --verify master:file2) &&
478 test_tick &&
479 cat >input <<-INPUT_END &&
480 commit refs/heads/branch
@@ -499,13 +499,13 @@ test_expect_success 'C: verify pack' '
499 '
500
501 test_expect_success 'C: validate reuse existing blob' '
502 - test $newf = `git rev-parse --verify branch:file2/newf` &&
503 - test $oldf = `git rev-parse --verify branch:file2/oldf`
502 + test $newf = $(git rev-parse --verify branch:file2/newf) &&
503 + test $oldf = $(git rev-parse --verify branch:file2/oldf)
504 '
505
506 test_expect_success 'C: verify commit' '
507 cat >expect <<-EOF &&
508 - parent `git rev-parse --verify master^0`
508 + parent $(git rev-parse --verify master^0)
509 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
510 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
511
@@ -624,7 +624,7 @@ test_expect_success 'E: verify commit' '
624 ###
625
626 test_expect_success 'F: non-fast-forward update skips' '
627 - old_branch=`git rev-parse --verify branch^0` &&
627 + old_branch=$(git rev-parse --verify branch^0) &&
628 test_tick &&
629 cat >input <<-INPUT_END &&
630 commit refs/heads/branch
@@ -642,7 +642,7 @@ test_expect_success 'F: non-fast-forward update skips' '
642
643 test_must_fail git fast-import <input &&
644 # branch must remain unaffected
645 - test $old_branch = `git rev-parse --verify branch^0`
645 + test $old_branch = $(git rev-parse --verify branch^0)
646 '
647
648 test_expect_success 'F: verify pack' '
@@ -651,8 +651,8 @@ test_expect_success 'F: verify pack' '
651
652 test_expect_success 'F: verify other commit' '
653 cat >expect <<-EOF &&
654 - tree `git rev-parse branch~1^{tree}`
655 - parent `git rev-parse branch~1`
654 + tree $(git rev-parse branch~1^{tree})
655 + parent $(git rev-parse branch~1)
656 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
657 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
658
@@ -667,7 +667,7 @@ test_expect_success 'F: verify other commit' '
667 ###
668
669 test_expect_success 'G: non-fast-forward update forced' '
670 - old_branch=`git rev-parse --verify branch^0` &&
670 + old_branch=$(git rev-parse --verify branch^0) &&
671 test_tick &&
672 cat >input <<-INPUT_END &&
673 commit refs/heads/branch
@@ -687,8 +687,8 @@ test_expect_success 'G: verify pack' '
687 '
688
689 test_expect_success 'G: branch changed, but logged' '
690 - test $old_branch != `git rev-parse --verify branch^0` &&
691 - test $old_branch = `git rev-parse --verify branch@{1}`
690 + test $old_branch != $(git rev-parse --verify branch^0) &&
691 + test $old_branch = $(git rev-parse --verify branch@{1})
692 '
693
694 ###
@@ -763,7 +763,7 @@ test_expect_success 'I: export-pack-edges' '
763
764 test_expect_success 'I: verify edge list' '
765 cat >expect <<-EOF &&
766 - .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
766 + .git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)
767 EOF
768 sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
769 test_cmp expect actual
@@ -795,8 +795,8 @@ test_expect_success 'J: reset existing branch creates empty commit' '
795 git fast-import <input
796 '
797 test_expect_success 'J: branch has 1 commit, empty tree' '
798 - test 1 = `git rev-list J | wc -l` &&
799 - test 0 = `git ls-tree J | wc -l`
798 + test 1 = $(git rev-list J | wc -l) &&
799 + test 0 = $(git ls-tree J | wc -l)
800 '
801
802 test_expect_success 'J: tag must fail on empty branch' '
@@ -838,8 +838,8 @@ test_expect_success 'K: reinit branch with from' '
838 git fast-import <input
839 '
840 test_expect_success 'K: verify K^1 = branch^1' '
841 - test `git rev-parse --verify branch^1` \
842 - = `git rev-parse --verify K^1`
841 + test $(git rev-parse --verify branch^1) \
842 + = $(git rev-parse --verify K^1)
843 '
844
845 ###
@@ -929,7 +929,7 @@ test_expect_success 'L: nested tree copy does not corrupt deltas' '
929 git ls-tree L2 g/b/ >tmp &&
930 cat tmp | cut -f 2 >actual &&
931 test_cmp expect actual &&
932 - git fsck `git rev-parse L2`
932 + git fsck $(git rev-parse L2)
933 '
934
935 ###
@@ -1106,7 +1106,7 @@ test_expect_success 'N: copy dirty subdirectory' '
1106 INPUT_END
1107
1108 git fast-import <input &&
1109 - test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`
1109 + test $(git rev-parse N2^{tree}) = $(git rev-parse N3^{tree})
1110 '
1111
1112 test_expect_success 'N: copy directory by id' '
@@ -1503,7 +1503,7 @@ test_expect_success 'O: comments are all skipped' '
1503 INPUT_END
1504
1505 git fast-import <input &&
1506 - test `git rev-parse N3` = `git rev-parse O1`
1506 + test $(git rev-parse N3) = $(git rev-parse O1)
1507 '
1508
1509 test_expect_success 'O: blank lines not necessary after data commands' '
@@ -1524,7 +1524,7 @@ test_expect_success 'O: blank lines not necessary after data commands' '
1524 INPUT_END
1525
1526 git fast-import <input &&
1527 - test `git rev-parse N3` = `git rev-parse O2`
1527 + test $(git rev-parse N3) = $(git rev-parse O2)
1528 '
1529
1530 test_expect_success 'O: repack before next test' '
@@ -1570,8 +1570,8 @@ test_expect_success 'O: blank lines not necessary after other commands' '
1570 INPUT_END
1571
1572 git fast-import <input &&
1573 - test 8 = `find .git/objects/pack -type f | wc -l` &&
1574 - test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
1573 + test 8 = $(find .git/objects/pack -type f | wc -l) &&
1574 + test $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&
1575 git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
1576 test_cmp expect actual
1577 '
@@ -1631,7 +1631,7 @@ test_expect_success 'P: superproject & submodule mix' '
1631 data <<DATAEND
1632 [submodule "sub"]
1633 path = sub
1634 - url = "`pwd`/sub"
1634 + url = "$(pwd)/sub"
1635 DATAEND
1636
1637 commit refs/heads/subuse1
@@ -1691,7 +1691,7 @@ test_expect_success 'P: verbatim SHA gitlinks' '
1691 data <<DATAEND
1692 [submodule "sub"]
1693 path = sub
1694 - url = "`pwd`/sub"
1694 + url = "$(pwd)/sub"
1695 DATAEND
1696
1697 commit refs/heads/subuse2
@@ -1978,7 +1978,7 @@ test_expect_success 'Q: verify first note for third commit' '
1978
1979 test_expect_success 'Q: verify second notes commit' '
1980 cat >expect <<-EOF &&
1981 - parent `git rev-parse --verify refs/notes/foobar~2`
1981 + parent $(git rev-parse --verify refs/notes/foobar~2)
1982 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1983 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1984
@@ -2045,7 +2045,7 @@ test_expect_success 'Q: verify third note for first commit' '
2045
2046 test_expect_success 'Q: verify fourth notes commit' '
2047 cat >expect <<-EOF &&
2048 - parent `git rev-parse --verify refs/notes/foobar^`
2048 + parent $(git rev-parse --verify refs/notes/foobar^)
2049 author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2050 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2051