Merge branch 'ep/shell-command-substitution-style'
authorJunio C Hamano <gitster@pobox.com>
Fri, 22 Jan 2016 21:08:46 +0000 (13:08 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Jan 2016 21:08:46 +0000 (13:08 -0800)
A shell script style update to change `command substitution` into
$(command substitution). Coverts contrib/ and much of the t/
directory contents.

* ep/shell-command-substitution-style: (92 commits)
t9901-git-web--browse.sh: use the $( ... ) construct for command substitution
t9501-gitweb-standalone-http-status.sh: use the $( ... ) construct for command substitution
t9350-fast-export.sh: use the $( ... ) construct for command substitution
t9300-fast-import.sh: use the $( ... ) construct for command substitution
t9150-svk-mergetickets.sh: use the $( ... ) construct for command substitution
t9145-git-svn-master-branch.sh: use the $( ... ) construct for command substitution
t9138-git-svn-authors-prog.sh: use the $( ... ) construct for command substitution
t9137-git-svn-dcommit-clobber-series.sh: use the $( ... ) construct for command substitution
t9132-git-svn-broken-symlink.sh: use the $( ... ) construct for command substitution
t9130-git-svn-authors-file.sh: use the $( ... ) construct for command substitution
t9129-git-svn-i18n-commitencoding.sh: use the $( ... ) construct for command substitution
t9119-git-svn-info.sh: use the $( ... ) construct for command substitution
t9118-git-svn-funky-branch-names.sh: use the $( ... ) construct for command substitution
t9114-git-svn-dcommit-merge.sh: use the $( ... ) construct for command substitution
t9110-git-svn-use-svm-props.sh: use the $( ... ) construct for command substitution
t9109-git-svn-multi-glob.sh: use the $( ... ) construct for command substitution
t9108-git-svn-glob.sh: use the $( ... ) construct for command substitution
t9107-git-svn-migrate.sh: use the $( ... ) construct for command substitution
t9105-git-svn-commit-diff.sh: use the $( ... ) construct for command substitution
t9104-git-svn-follow-parent.sh: use the $( ... ) construct for command substitution
...

1  2 
t/t1401-symbolic-ref.sh
t/t1410-reflog.sh
t/t5601-clone.sh
t/t9001-send-email.sh
diff --combined t/t1401-symbolic-ref.sh
index 1f0dff3a0b1cedb95b900a01de972e8a02e29f90,e6c5830d70e9de7ea61c91d2ddc157dfd5fc9734..ce8b4f4d0f375fb49afdb80d002559464a5b2812
@@@ -29,7 -29,7 +29,7 @@@ reset_to_san
  
  test_expect_success 'symbolic-ref refuses bare sha1' '
        echo content >file && git add file && git commit -m one &&
-       test_must_fail git symbolic-ref HEAD `git rev-parse HEAD`
+       test_must_fail git symbolic-ref HEAD $(git rev-parse HEAD)
  '
  reset_to_sane
  
@@@ -92,26 -92,4 +92,26 @@@ test_expect_success LONG_REF 'we can pa
        test_cmp expect actual
  '
  
 +test_expect_success 'symbolic-ref reports failure in exit code' '
 +      test_when_finished "rm -f .git/HEAD.lock" &&
 +      >.git/HEAD.lock &&
 +      test_must_fail git symbolic-ref HEAD refs/heads/whatever
 +'
 +
 +test_expect_success 'symbolic-ref writes reflog entry' '
 +      git checkout -b log1 &&
 +      test_commit one &&
 +      git checkout -b log2  &&
 +      test_commit two &&
 +      git checkout --orphan orphan &&
 +      git symbolic-ref -m create HEAD refs/heads/log1 &&
 +      git symbolic-ref -m update HEAD refs/heads/log2 &&
 +      cat >expect <<-\EOF &&
 +      update
 +      create
 +      EOF
 +      git log --format=%gs -g >actual &&
 +      test_cmp expect actual
 +'
 +
  test_done
diff --combined t/t1410-reflog.sh
index 17a194bfa6e80871f6cb002e1ee3bcd0c832be84,fbed8d7fb75a203383647499f2816ddf16080df3..c623824b4d0c2bfde08a69c242e4c5340b97abd3
@@@ -62,18 -62,18 +62,18 @@@ test_expect_success setup 
        git add . &&
  
        test_tick && git commit -m rabbit &&
-       H=`git rev-parse --verify HEAD` &&
-       A=`git rev-parse --verify HEAD:A` &&
-       B=`git rev-parse --verify HEAD:A/B` &&
-       C=`git rev-parse --verify HEAD:C` &&
-       D=`git rev-parse --verify HEAD:A/D` &&
-       E=`git rev-parse --verify HEAD:A/B/E` &&
+       H=$(git rev-parse --verify HEAD) &&
+       A=$(git rev-parse --verify HEAD:A) &&
+       B=$(git rev-parse --verify HEAD:A/B) &&
+       C=$(git rev-parse --verify HEAD:C) &&
+       D=$(git rev-parse --verify HEAD:A/D) &&
+       E=$(git rev-parse --verify HEAD:A/B/E) &&
        check_fsck &&
  
        test_chmod +x C &&
        git add C &&
        test_tick && git commit -m dragon &&
-       L=`git rev-parse --verify HEAD` &&
+       L=$(git rev-parse --verify HEAD) &&
        check_fsck &&
  
        rm -f C A/B/E &&
        echo horse >A/G &&
        git add F A/G &&
        test_tick && git commit -a -m sheep &&
-       F=`git rev-parse --verify HEAD:F` &&
-       G=`git rev-parse --verify HEAD:A/G` &&
-       I=`git rev-parse --verify HEAD:A` &&
-       J=`git rev-parse --verify HEAD` &&
+       F=$(git rev-parse --verify HEAD:F) &&
+       G=$(git rev-parse --verify HEAD:A/G) &&
+       I=$(git rev-parse --verify HEAD:A) &&
+       J=$(git rev-parse --verify HEAD) &&
        check_fsck &&
  
        rm -f A/G &&
        test_tick && git commit -a -m monkey &&
-       K=`git rev-parse --verify HEAD` &&
+       K=$(git rev-parse --verify HEAD) &&
        check_fsck &&
  
        check_have A B C D E F G H I J K L &&
@@@ -325,17 -325,4 +325,17 @@@ test_expect_success 'parsing reverse re
        test_cmp expect actual
  '
  
 +test_expect_success 'no segfaults for reflog containing non-commit sha1s' '
 +      git update-ref --create-reflog -m "Creating ref" \
 +              refs/tests/tree-in-reflog HEAD &&
 +      git update-ref -m "Forcing tree" refs/tests/tree-in-reflog HEAD^{tree} &&
 +      git update-ref -m "Restoring to commit" refs/tests/tree-in-reflog HEAD &&
 +      git reflog refs/tests/tree-in-reflog
 +'
 +
 +test_expect_failure 'reflog with non-commit entries displays all entries' '
 +      git reflog refs/tests/tree-in-reflog >actual &&
 +      test_line_count = 3 actual
 +'
 +
  test_done
diff --combined t/t5601-clone.sh
index 31b46582d79889c4d85879e7dedfc2c618b274d1,61dc4ce12570a20bb93c5c8a2fd061b2966f714c..669ec9ba811fedeca820c4454b490e975b03bfca
@@@ -65,29 -65,6 +65,29 @@@ test_expect_success 'clone respects GIT
  
  '
  
 +test_expect_success 'clone from hooks' '
 +
 +      test_create_repo r0 &&
 +      cd r0 &&
 +      test_commit initial &&
 +      cd .. &&
 +      git init r1 &&
 +      cd r1 &&
 +      cat >.git/hooks/pre-commit <<-\EOF &&
 +      #!/bin/sh
 +      git clone ../r0 ../r2
 +      exit 1
 +      EOF
 +      chmod u+x .git/hooks/pre-commit &&
 +      : >file &&
 +      git add file &&
 +      test_must_fail git commit -m invoke-hook &&
 +      cd .. &&
 +      test_cmp r0/.git/HEAD r2/.git/HEAD &&
 +      test_cmp r0/initial.t r2/initial.t
 +
 +'
 +
  test_expect_success 'clone creates intermediate directories' '
  
        git clone src long/path/to/dst &&
@@@ -244,7 -221,7 +244,7 @@@ test_expect_success 'clone separate git
  '
  
  test_expect_success 'clone separate gitdir: output' '
-       echo "gitdir: `pwd`/realgitdir" >expected &&
+       echo "gitdir: $(pwd)/realgitdir" >expected &&
        test_cmp expected dst/.git
  '
  
diff --combined t/t9001-send-email.sh
index 834d91a691556530cd85cc34b2e3f0330764d253,0460880c9508f0033e34baf79ed0855f70e73ea2..b3355d2c7016e55e99a465414f230569c3807230
@@@ -36,7 -36,7 +36,7 @@@ clean_fake_sendmail () 
  }
  
  test_expect_success $PREREQ 'Extract patches' '
-       patches=`git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1`
+       patches=$(git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1)
  '
  
  # Test no confirm early to ensure remaining tests will not hang
@@@ -1151,7 -1151,7 +1151,7 @@@ test_expect_success $PREREQ '--no-bcc o
  '
  
  test_expect_success $PREREQ 'patches To headers are used by default' '
-       patch=`git format-patch -1 --to="bodies@example.com"` &&
+       patch=$(git format-patch -1 --to="bodies@example.com") &&
        test_when_finished "rm $patch" &&
        git send-email \
                --dry-run \
  '
  
  test_expect_success $PREREQ 'patches To headers are appended to' '
-       patch=`git format-patch -1 --to="bodies@example.com"` &&
+       patch=$(git format-patch -1 --to="bodies@example.com") &&
        test_when_finished "rm $patch" &&
        git send-email \
                --dry-run \
  '
  
  test_expect_success $PREREQ 'To headers from files reset each patch' '
-       patch1=`git format-patch -1 --to="bodies@example.com"` &&
-       patch2=`git format-patch -1 --to="other@example.com" HEAD~` &&
+       patch1=$(git format-patch -1 --to="bodies@example.com") &&
+       patch2=$(git format-patch -1 --to="other@example.com" HEAD~) &&
        test_when_finished "rm $patch1 && rm $patch2" &&
        git send-email \
                --dry-run \
@@@ -1488,7 -1488,7 +1488,7 @@@ test_cover_addresses () 
        clean_fake_sendmail &&
        rm -fr outdir &&
        git format-patch --cover-letter -2 -o outdir &&
-       cover=`echo outdir/0000-*.patch` &&
+       cover=$(echo outdir/0000-*.patch) &&
        mv $cover cover-to-edit.patch &&
        perl -pe "s/^From:/$header: extra\@address.com\nFrom:/" cover-to-edit.patch >"$cover" &&
        git send-email \
@@@ -1527,21 -1527,6 +1527,21 @@@ test_expect_success $PREREQ 'cccover ad
        test_cover_addresses "Cc"
  '
  
 +test_expect_success $PREREQ 'escaped quotes in sendemail.aliasfiletype=mutt' '
 +      clean_fake_sendmail &&
 +      echo "alias sbd \\\"Dot U. Sir\\\" <somebody@example.org>" >.mutt &&
 +      git config --replace-all sendemail.aliasesfile "$(pwd)/.mutt" &&
 +      git config sendemail.aliasfiletype mutt &&
 +      git send-email \
 +              --from="Example <nobody@example.com>" \
 +              --to=sbd \
 +              --smtp-server="$(pwd)/fake.sendmail" \
 +              outdir/0001-*.patch \
 +              2>errors >out &&
 +      grep "^!somebody@example\.org!$" commandline1 &&
 +      grep -F "To: \"Dot U. Sir\" <somebody@example.org>" out
 +'
 +
  test_expect_success $PREREQ 'sendemail.aliasfiletype=mailrc' '
        clean_fake_sendmail &&
        echo "alias sbd  somebody@example.org" >.mailrc &&