Merge branch 'ep/shell-command-substitution'
authorJunio C Hamano <gitster@pobox.com>
Tue, 3 Jun 2014 19:06:45 +0000 (12:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Jun 2014 19:06:45 +0000 (12:06 -0700)
Adjust shell scripts to use $(cmd) instead of `cmd`.

* ep/shell-command-substitution: (41 commits)
t5000-tar-tree.sh: use the $( ... ) construct for command substitution
t4204-patch-id.sh: use the $( ... ) construct for command substitution
t4119-apply-config.sh: use the $( ... ) construct for command substitution
t4116-apply-reverse.sh: use the $( ... ) construct for command substitution
t4057-diff-combined-paths.sh: use the $( ... ) construct for command substitution
t4038-diff-combined.sh: use the $( ... ) construct for command substitution
t4036-format-patch-signer-mime.sh: use the $( ... ) construct for command substitution
t4014-format-patch.sh: use the $( ... ) construct for command substitution
t4013-diff-various.sh: use the $( ... ) construct for command substitution
t4012-diff-binary.sh: use the $( ... ) construct for command substitution
t4010-diff-pathspec.sh: use the $( ... ) construct for command substitution
t4006-diff-mode.sh: use the $( ... ) construct for command substitution
t3910-mac-os-precompose.sh: use the $( ... ) construct for command substitution
t3905-stash-include-untracked.sh: use the $( ... ) construct for command substitution
t1050-large.sh: use the $( ... ) construct for command substitution
t1020-subdirectory.sh: use the $( ... ) construct for command substitution
t1004-read-tree-m-u-wf.sh: use the $( ... ) construct for command substitution
t1003-read-tree-prefix.sh: use the $( ... ) construct for command substitution
t1002-read-tree-m-u-2way.sh: use the $( ... ) construct for command substitution
t1001-read-tree-m-2way.sh: use the $( ... ) construct for command substitution
...

1  2 
contrib/mw-to-git/t/test-gitmw-lib.sh
git-rebase--merge.sh
git-rebase.sh
t/t0001-init.sh
t/t1001-read-tree-m-2way.sh
t/t4014-format-patch.sh
index d9a114995a0f75434fc105ce7be508293da49227,c783752e02041ef3ab9d2d799b93bed416a27d67..6546294f159e940eb8f7adc3e695f16d9395eebc
@@@ -90,7 -90,7 +90,7 @@@ test_diff_directories () 
  #
  # Check that <dir> contains exactly <N> files
  test_contains_N_files () {
-       if test `ls -- "$1" | wc -l` -ne "$2"; then
+       if test $(ls -- "$1" | wc -l) -ne "$2"; then
                echo "directory $1 should contain $2 files"
                echo "it contains these files:"
                ls "$1"
@@@ -289,6 -289,7 +289,6 @@@ start_lighttpd () 
  # Kill daemon lighttpd and removes files and folders associated.
  stop_lighttpd () {
        test -f "$WEB_TMP/pid" && kill $(cat "$WEB_TMP/pid")
 -      rm -rf "$WEB"
  }
  
  # Create the SQLite database of the MediaWiki. If the database file already
@@@ -340,10 -341,10 +340,10 @@@ wiki_install () 
                        "http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/"\
                        "$MW_FILENAME. "\
                        "Please fix your connection and launch the script again."
-               echo "$MW_FILENAME downloaded in `pwd`. "\
+               echo "$MW_FILENAME downloaded in $(pwd). "\
                        "You can delete it later if you want."
        else
-               echo "Reusing existing $MW_FILENAME downloaded in `pwd`."
+               echo "Reusing existing $MW_FILENAME downloaded in $(pwd)."
        fi
        archive_abs_path=$(pwd)/$MW_FILENAME
        cd "$WIKI_DIR_INST/$WIKI_DIR_NAME/" ||
@@@ -414,7 -415,6 +414,7 @@@ wiki_reset () 
  wiki_delete () {
        if test $LIGHTTPD = "true"; then
                stop_lighttpd
 +              rm -fr "$WEB"
        else
                # Delete the wiki's directory.
                rm -rf "$WIKI_DIR_INST/$WIKI_DIR_NAME" ||
diff --combined git-rebase--merge.sh
index 71429fd74373f3f804fc841b5dd60faca2baaec6,dc064f82b60a00847de9a42dd1979b0a0f03e4ee..6d77b3ca9118e6fdd36615757a24c109cf0530ee
@@@ -24,7 -24,7 +24,7 @@@ continue_merge () 
                die "$resolvemsg"
        fi
  
-       cmt=`cat "$state_dir/current"`
+       cmt=$(cat "$state_dir/current")
        if ! git diff-index --quiet --ignore-submodules HEAD --
        then
                if ! git commit ${gpg_sign_opt:+"$gpg_sign_opt"} --no-verify -C "$cmt"
@@@ -101,17 -101,6 +101,17 @@@ finish_rb_merge () 
        say All done.
  }
  
 +# The whole contents of this file is run by dot-sourcing it from
 +# inside a shell function.  It used to be that "return"s we see
 +# below were not inside any function, and expected to return
 +# to the function that dot-sourced us.
 +#
 +# However, FreeBSD /bin/sh misbehaves on such a construct and
 +# continues to run the statements that follow such a "return".
 +# As a work-around, we introduce an extra layer of a function
 +# here, and immediately call it after defining it.
 +git_rebase__merge () {
 +
  case "$action" in
  continue)
        read_state
@@@ -143,7 -132,7 +143,7 @@@ echo "$onto_name" > "$state_dir/onto_na
  write_basic_state
  
  msgnum=0
- for cmt in `git rev-list --reverse --no-merges "$revisions"`
+ for cmt in $(git rev-list --reverse --no-merges "$revisions")
  do
        msgnum=$(($msgnum + 1))
        echo "$cmt" > "$state_dir/cmt.$msgnum"
@@@ -162,7 -151,3 +162,7 @@@ d
  done
  
  finish_rb_merge
 +
 +}
 +# ... and then we call the whole thing.
 +git_rebase__merge
diff --combined git-rebase.sh
index 4543815ffd6b0d49466edc3059f6d085b79ebf8a,a209ab9ce4ecc58ebaac293cd21cf3c031447abf..5c7a0a1a583552de49ee2e094e80f80ee18fd68c
@@@ -175,13 -175,22 +175,13 @@@ You can run "git stash pop" or "git sta
        rm -rf "$state_dir"
  }
  
 -run_specific_rebase_internal () {
 +run_specific_rebase () {
        if [ "$interactive_rebase" = implied ]; then
                GIT_EDITOR=:
                export GIT_EDITOR
                autosquash=
        fi
 -      # On FreeBSD, the shell's "return" returns from the current
 -      # function, not from the current file inclusion.
 -      # run_specific_rebase_internal has the file inclusion as a
 -      # last statement, so POSIX and FreeBSD's return will do the
 -      # same thing.
        . git-rebase--$type
 -}
 -
 -run_specific_rebase () {
 -      run_specific_rebase_internal
        ret=$?
        if test $ret -eq 0
        then
@@@ -444,10 -453,6 +444,10 @@@ the
                test "$fork_point" = auto && fork_point=t
                ;;
        *)      upstream_name="$1"
 +              if test "$upstream_name" = "-"
 +              then
 +                      upstream_name="@{-1}"
 +              fi
                shift
                ;;
        esac
  else
        if test -z "$onto"
        then
-               empty_tree=`git hash-object -t tree /dev/null`
-               onto=`git commit-tree $empty_tree </dev/null`
+               empty_tree=$(git hash-object -t tree /dev/null)
+               onto=$(git commit-tree $empty_tree </dev/null)
                squash_onto="$onto"
        fi
        unset upstream_name
@@@ -516,10 -521,10 +516,10 @@@ case "$#" i
        ;;
  0)
        # Do not need to switch branches, we are already on it.
-       if branch_name=`git symbolic-ref -q HEAD`
+       if branch_name=$(git symbolic-ref -q HEAD)
        then
                head_name=$branch_name
-               branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'`
+               branch_name=$(expr "z$branch_name" : 'zrefs/heads/\(.*\)')
        else
                head_name="detached HEAD"
                branch_name=HEAD ;# detached
diff --combined t/t0001-init.sh
index bbc9cb60ddea49f1ce3f0b0d124f704c30a61346,32821fe450d6116037d092d58db4933bbe6fd0c0..2f3020342a75f0d382af88e6ad35691ad0f183d5
@@@ -12,8 -12,8 +12,8 @@@ check_config () 
                echo "expected a directory $1, a file $1/config and $1/refs"
                return 1
        fi
 -      bare=$(GIT_CONFIG="$1/config" git config --bool core.bare)
 -      worktree=$(GIT_CONFIG="$1/config" git config core.worktree) ||
 +      bare=$(cd "$1" && git config --bool core.bare)
 +      worktree=$(cd "$1" && git config core.worktree) ||
        worktree=unset
  
        test "$bare" = "$2" && test "$worktree" = "$3" || {
  }
  
  test_expect_success 'plain' '
 -      (
 -              sane_unset GIT_DIR GIT_WORK_TREE &&
 -              mkdir plain &&
 -              cd plain &&
 -              git init
 -      ) &&
 +      git init plain &&
        check_config plain/.git false unset
  '
  
  test_expect_success 'plain nested in bare' '
        (
 -              sane_unset GIT_DIR GIT_WORK_TREE &&
                git init --bare bare-ancestor.git &&
                cd bare-ancestor.git &&
                mkdir plain-nested &&
@@@ -41,6 -47,7 +41,6 @@@
  
  test_expect_success 'plain through aliased command, outside any git repo' '
        (
 -              sane_unset GIT_DIR GIT_WORK_TREE &&
                HOME=$(pwd)/alias-config &&
                export HOME &&
                mkdir alias-config &&
@@@ -58,6 -65,7 +58,6 @@@
  
  test_expect_failure 'plain nested through aliased command' '
        (
 -              sane_unset GIT_DIR GIT_WORK_TREE &&
                git init plain-ancestor-aliased &&
                cd plain-ancestor-aliased &&
                echo "[alias] aliasedinit = init" >>.git/config &&
@@@ -70,6 -78,7 +70,6 @@@
  
  test_expect_failure 'plain nested in bare through aliased command' '
        (
 -              sane_unset GIT_DIR GIT_WORK_TREE &&
                git init --bare bare-ancestor-aliased.git &&
                cd bare-ancestor-aliased.git &&
                echo "[alias] aliasedinit = init" >>config &&
  '
  
  test_expect_success 'plain with GIT_WORK_TREE' '
 -      if (
 -              sane_unset GIT_DIR &&
 -              mkdir plain-wt &&
 -              cd plain-wt &&
 -              GIT_WORK_TREE=$(pwd) git init
 -      )
 -      then
 -              echo Should have failed -- GIT_WORK_TREE should not be used
 -              false
 -      fi
 +      mkdir plain-wt &&
 +      test_must_fail env GIT_WORK_TREE="$(pwd)/plain-wt" git init plain-wt
  '
  
  test_expect_success 'plain bare' '
 -      (
 -              sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
 -              mkdir plain-bare-1 &&
 -              cd plain-bare-1 &&
 -              git --bare init
 -      ) &&
 +      git --bare init plain-bare-1 &&
        check_config plain-bare-1 true unset
  '
  
  test_expect_success 'plain bare with GIT_WORK_TREE' '
 -      if (
 -              sane_unset GIT_DIR GIT_CONFIG &&
 -              mkdir plain-bare-2 &&
 -              cd plain-bare-2 &&
 -              GIT_WORK_TREE=$(pwd) git --bare init
 -      )
 -      then
 -              echo Should have failed -- GIT_WORK_TREE should not be used
 -              false
 -      fi
 +      mkdir plain-bare-2 &&
 +      test_must_fail \
 +              env GIT_WORK_TREE="$(pwd)/plain-bare-2" \
 +              git --bare init plain-bare-2
  '
  
  test_expect_success 'GIT_DIR bare' '
 -
 -      (
 -              sane_unset GIT_CONFIG &&
 -              mkdir git-dir-bare.git &&
 -              GIT_DIR=git-dir-bare.git git init
 -      ) &&
 +      mkdir git-dir-bare.git &&
 +      GIT_DIR=git-dir-bare.git git init &&
        check_config git-dir-bare.git true unset
  '
  
  test_expect_success 'init --bare' '
 -
 -      (
 -              sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
 -              mkdir init-bare.git &&
 -              cd init-bare.git &&
 -              git init --bare
 -      ) &&
 +      git init --bare init-bare.git &&
        check_config init-bare.git true unset
  '
  
  test_expect_success 'GIT_DIR non-bare' '
  
        (
 -              sane_unset GIT_CONFIG &&
                mkdir non-bare &&
                cd non-bare &&
                GIT_DIR=.git git init
  test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' '
  
        (
 -              sane_unset GIT_CONFIG &&
                mkdir git-dir-wt-1.git &&
                GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init
        ) &&
  '
  
  test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
 -
 -      if (
 -              sane_unset GIT_CONFIG &&
 -              mkdir git-dir-wt-2.git &&
 -              GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-2.git git --bare init
 -      )
 -      then
 -              echo Should have failed -- --bare should not be used
 -              false
 -      fi
 +      mkdir git-dir-wt-2.git &&
 +      test_must_fail env \
 +              GIT_WORK_TREE="$(pwd)" \
 +              GIT_DIR=git-dir-wt-2.git \
 +              git --bare init
  '
  
  test_expect_success 'reinit' '
  
        (
 -              sane_unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG &&
 -
                mkdir again &&
                cd again &&
                git init >out1 2>err1 &&
  test_expect_success 'init with --template' '
        mkdir template-source &&
        echo content >template-source/file &&
 -      (
 -              mkdir template-custom &&
 -              cd template-custom &&
 -              git init --template=../template-source
 -      ) &&
 +      git init --template=../template-source template-custom &&
        test_cmp template-source/file template-custom/.git/file
  '
  
  test_expect_success 'init with --template (blank)' '
 -      (
 -              mkdir template-plain &&
 -              cd template-plain &&
 -              git init
 -      ) &&
 -      test -f template-plain/.git/info/exclude &&
 -      (
 -              mkdir template-blank &&
 -              cd template-blank &&
 -              git init --template=
 -      ) &&
 -      ! test -f template-blank/.git/info/exclude
 +      git init template-plain &&
 +      test_path_is_file template-plain/.git/info/exclude &&
 +      git init --template= template-blank &&
 +      test_path_is_missing template-blank/.git/info/exclude
  '
  
  test_expect_success 'init with init.templatedir set' '
        mkdir templatedir-source &&
        echo Content >templatedir-source/file &&
 +      test_config_global init.templatedir "${HOME}/templatedir-source" &&
        (
 -              test_config="${HOME}/.gitconfig" &&
 -              git config -f "$test_config"  init.templatedir "${HOME}/templatedir-source" &&
                mkdir templatedir-set &&
                cd templatedir-set &&
                sane_unset GIT_TEMPLATE_DIR &&
  '
  
  test_expect_success 'init --bare/--shared overrides system/global config' '
 -      (
 -              test_config="$HOME"/.gitconfig &&
 -              git config -f "$test_config" core.bare false &&
 -              git config -f "$test_config" core.sharedRepository 0640 &&
 -              mkdir init-bare-shared-override &&
 -              cd init-bare-shared-override &&
 -              git init --bare --shared=0666
 -      ) &&
 +      test_config_global core.bare false &&
 +      test_config_global core.sharedRepository 0640 &&
 +      git init --bare --shared=0666 init-bare-shared-override &&
        check_config init-bare-shared-override true unset &&
        test x0666 = \
-       x`git config -f init-bare-shared-override/config core.sharedRepository`
+       x$(git config -f init-bare-shared-override/config core.sharedRepository)
  '
  
  test_expect_success 'init honors global core.sharedRepository' '
 -      (
 -              test_config="$HOME"/.gitconfig &&
 -              git config -f "$test_config" core.sharedRepository 0666 &&
 -              mkdir shared-honor-global &&
 -              cd shared-honor-global &&
 -              git init
 -      ) &&
 +      test_config_global core.sharedRepository 0666 &&
 +      git init shared-honor-global &&
        test x0666 = \
-       x`git config -f shared-honor-global/.git/config core.sharedRepository`
+       x$(git config -f shared-honor-global/.git/config core.sharedRepository)
  '
  
  test_expect_success 'init rejects insanely long --template' '
 -      (
 -              insane=$(printf "x%09999dx" 1) &&
 -              mkdir test &&
 -              cd test &&
 -              test_must_fail git init --template=$insane
 -      )
 +      test_must_fail git init --template=$(printf "x%09999dx" 1) test
  '
  
  test_expect_success 'init creates a new directory' '
        rm -fr newdir &&
 -      (
 -              git init newdir &&
 -              test -d newdir/.git/refs
 -      )
 +      git init newdir &&
 +      test_path_is_dir newdir/.git/refs
  '
  
  test_expect_success 'init creates a new bare directory' '
        rm -fr newdir &&
 -      (
 -              git init --bare newdir &&
 -              test -d newdir/refs
 -      )
 +      git init --bare newdir &&
 +      test_path_is_dir newdir/refs
  '
  
  test_expect_success 'init recreates a directory' '
        rm -fr newdir &&
 -      (
 -              mkdir newdir &&
 -              git init newdir &&
 -              test -d newdir/.git/refs
 -      )
 +      mkdir newdir &&
 +      git init newdir &&
 +      test_path_is_dir newdir/.git/refs
  '
  
  test_expect_success 'init recreates a new bare directory' '
        rm -fr newdir &&
 -      (
 -              mkdir newdir &&
 -              git init --bare newdir &&
 -              test -d newdir/refs
 -      )
 +      mkdir newdir &&
 +      git init --bare newdir &&
 +      test_path_is_dir newdir/refs
  '
  
  test_expect_success 'init creates a new deep directory' '
        rm -fr newdir &&
        git init newdir/a/b/c &&
 -      test -d newdir/a/b/c/.git/refs
 +      test_path_is_dir newdir/a/b/c/.git/refs
  '
  
  test_expect_success POSIXPERM 'init creates a new deep directory (umask vs. shared)' '
                # the repository itself should follow "shared"
                umask 002 &&
                git init --bare --shared=0660 newdir/a/b/c &&
 -              test -d newdir/a/b/c/refs &&
 +              test_path_is_dir newdir/a/b/c/refs &&
                ls -ld newdir/a newdir/a/b > lsab.out &&
                ! grep -v "^drwxrw[sx]r-x" lsab.out &&
                ls -ld newdir/a/b/c > lsc.out &&
  
  test_expect_success 'init notices EEXIST (1)' '
        rm -fr newdir &&
 -      (
 -              >newdir &&
 -              test_must_fail git init newdir &&
 -              test -f newdir
 -      )
 +      >newdir &&
 +      test_must_fail git init newdir &&
 +      test_path_is_file newdir
  '
  
  test_expect_success 'init notices EEXIST (2)' '
        rm -fr newdir &&
 -      (
 -              mkdir newdir &&
 -              >newdir/a
 -              test_must_fail git init newdir/a/b &&
 -              test -f newdir/a
 -      )
 +      mkdir newdir &&
 +      >newdir/a &&
 +      test_must_fail git init newdir/a/b &&
 +      test_path_is_file newdir/a
  '
  
  test_expect_success POSIXPERM,SANITY 'init notices EPERM' '
        rm -fr newdir &&
 -      (
 -              mkdir newdir &&
 -              chmod -w newdir &&
 -              test_must_fail git init newdir/a/b
 -      )
 +      mkdir newdir &&
 +      chmod -w newdir &&
 +      test_must_fail git init newdir/a/b
  '
  
  test_expect_success 'init creates a new bare directory with global --bare' '
        rm -rf newdir &&
        git --bare init newdir &&
 -      test -d newdir/refs
 +      test_path_is_dir newdir/refs
  '
  
  test_expect_success 'init prefers command line to GIT_DIR' '
        rm -rf newdir &&
        mkdir otherdir &&
        GIT_DIR=otherdir git --bare init newdir &&
 -      test -d newdir/refs &&
 -      ! test -d otherdir/refs
 +      test_path_is_dir newdir/refs &&
 +      test_path_is_missing otherdir/refs
  '
  
  test_expect_success 'init with separate gitdir' '
        rm -rf newdir &&
        git init --separate-git-dir realgitdir newdir &&
-       echo "gitdir: `pwd`/realgitdir" >expected &&
+       echo "gitdir: $(pwd)/realgitdir" >expected &&
        test_cmp expected newdir/.git &&
 -      test -d realgitdir/refs
 +      test_path_is_dir realgitdir/refs
  '
  
  test_expect_success 're-init on .git file' '
@@@ -299,10 -388,10 +299,10 @@@ test_expect_success 're-init to update 
        cd newdir &&
        git init --separate-git-dir ../surrealgitdir
        ) &&
-       echo "gitdir: `pwd`/surrealgitdir" >expected &&
+       echo "gitdir: $(pwd)/surrealgitdir" >expected &&
        test_cmp expected newdir/.git &&
 -      test -d surrealgitdir/refs &&
 -      ! test -d realgitdir/refs
 +      test_path_is_dir surrealgitdir/refs &&
 +      test_path_is_missing realgitdir/refs
  '
  
  test_expect_success 're-init to move gitdir' '
        cd newdir &&
        git init --separate-git-dir ../realgitdir
        ) &&
-       echo "gitdir: `pwd`/realgitdir" >expected &&
+       echo "gitdir: $(pwd)/realgitdir" >expected &&
        test_cmp expected newdir/.git &&
 -      test -d realgitdir/refs
 +      test_path_is_dir realgitdir/refs
  '
  
  test_expect_success SYMLINKS 're-init to move gitdir symlink' '
        ln -s here .git &&
        git init --separate-git-dir ../realgitdir
        ) &&
-       echo "gitdir: `pwd`/realgitdir" >expected &&
+       echo "gitdir: $(pwd)/realgitdir" >expected &&
        test_cmp expected newdir/.git &&
 -      test -d realgitdir/refs &&
 -      ! test -d newdir/here
 +      test_cmp expected newdir/here &&
 +      test_path_is_dir realgitdir/refs
  '
  
  test_done
index 3a24abf5496c76862e772907442dc24bdcb4d78a,f0d8eb91b42d7aefe0d1e1a2071fb0a4bdc15af8..db1b6f5cf4dd8c7932946a53bc2e1c30b09b762b
@@@ -18,7 -18,7 +18,7 @@@ In the test, these paths are used
          frotz   - not in H added in M
          nitfol  - in H, stays in M unmodified
          rezrov  - in H, deleted in M
 -        yomin   - not in H nor M
 +      yomin   - not in H or M
  '
  . ./test-lib.sh
  . "$TEST_DIRECTORY"/lib-read-tree.sh
@@@ -36,7 -36,7 +36,7 @@@ compare_change () 
  }
  
  check_cache_at () {
-       clean_if_empty=`git diff-files -- "$1"`
+       clean_if_empty=$(git diff-files -- "$1")
        case "$clean_if_empty" in
        '')  echo "$1: clean" ;;
        ?*)  echo "$1: dirty" ;;
@@@ -68,14 -68,14 +68,14 @@@ test_expect_success 
       echo rezrov >rezrov &&
       echo yomin >yomin &&
       git update-index --add nitfol bozbar rezrov &&
-      treeH=`git write-tree` &&
+      treeH=$(git write-tree) &&
       echo treeH $treeH &&
       git ls-tree $treeH &&
  
       cat bozbar-new >bozbar &&
       git update-index --add frotz bozbar --force-remove rezrov &&
       git ls-files --stage >M.out &&
-      treeM=`git write-tree` &&
+      treeM=$(git write-tree) &&
       echo treeM $treeM &&
       git ls-tree $treeM &&
       git diff-tree $treeH $treeM'
@@@ -315,7 -315,7 +315,7 @@@ test_expect_success 
      'rm -f .git/index &&
       echo DF >DF &&
       git update-index --add DF &&
-      treeDF=`git write-tree` &&
+      treeDF=$(git write-tree) &&
       echo treeDF $treeDF &&
       git ls-tree $treeDF &&
  
       mkdir DF &&
       echo DF/DF >DF/DF &&
       git update-index --add --remove DF DF/DF &&
-      treeDFDF=`git write-tree` &&
+      treeDFDF=$(git write-tree) &&
       echo treeDFDF $treeDFDF &&
       git ls-tree $treeDFDF &&
       git ls-files --stage >DFDF.out'
@@@ -345,7 -345,7 +345,7 @@@ test_expect_success 
      'rm -f .git/index &&
       : >a &&
       git update-index --add a &&
-      treeM=`git write-tree` &&
+      treeM=$(git write-tree) &&
       echo treeM $treeM &&
       git ls-tree $treeM &&
       git ls-files --stage >treeM.out &&
       git update-index --remove a &&
       mkdir a &&
       : >a/b &&
-      treeH=`git write-tree` &&
+      treeH=$(git write-tree) &&
       echo treeH $treeH &&
       git ls-tree $treeH'
  
@@@ -372,7 -372,7 +372,7 @@@ test_expect_success 
       mkdir c &&
       : >c/d &&
       git update-index --add a c/d &&
-      treeM=`git write-tree` &&
+      treeM=$(git write-tree) &&
       echo treeM $treeM &&
       git ls-tree $treeM &&
       git ls-files --stage >treeM.out &&
       mkdir a &&
       : >a/b &&
       git update-index --add --remove a a/b &&
-      treeH=`git write-tree` &&
+      treeH=$(git write-tree) &&
       echo treeH $treeH &&
       git ls-tree $treeH'
  
diff --combined t/t4014-format-patch.sh
index 9c8063314688ec0c03d3fb2099379cbbf4ff2e19,f9ed598afbba105f33a86efdaaf29bb72c8e1c8f..282bee4a54c924b8168b6a28dfdbeb7ab300d7b7
@@@ -43,7 -43,7 +43,7 @@@ test_expect_success setup 
  test_expect_success "format-patch --ignore-if-in-upstream" '
  
        git format-patch --stdout master..side >patch0 &&
-       cnt=`grep "^From " patch0 | wc -l` &&
+       cnt=$(grep "^From " patch0 | wc -l) &&
        test $cnt = 3
  
  '
@@@ -52,7 -52,7 +52,7 @@@ test_expect_success "format-patch --ign
  
        git format-patch --stdout \
                --ignore-if-in-upstream master..side >patch1 &&
-       cnt=`grep "^From " patch1 | wc -l` &&
+       cnt=$(grep "^From " patch1 | wc -l) &&
        test $cnt = 2
  
  '
@@@ -69,7 -69,7 +69,7 @@@ test_expect_success "format-patch doesn
        git checkout -b merger master &&
        test_tick &&
        git merge --no-ff slave &&
-       cnt=`git format-patch -3 --stdout | grep "^From " | wc -l` &&
+       cnt=$(git format-patch -3 --stdout | grep "^From " | wc -l) &&
        test $cnt = 3
  '
  
@@@ -77,7 -77,7 +77,7 @@@ test_expect_success "format-patch resul
  
        git checkout -b rebuild-0 master &&
        git am -3 patch0 &&
-       cnt=`git rev-list master.. | wc -l` &&
+       cnt=$(git rev-list master.. | wc -l) &&
        test $cnt = 2
  '
  
@@@ -85,7 -85,7 +85,7 @@@ test_expect_success "format-patch --ign
  
        git checkout -b rebuild-1 master &&
        git am -3 patch1 &&
-       cnt=`git rev-list master.. | wc -l` &&
+       cnt=$(git rev-list master.. | wc -l) &&
        test $cnt = 2
  '
  
@@@ -764,14 -764,22 +764,14 @@@ test_expect_success 'format-patch --sig
  
  test_expect_success TTY 'format-patch --stdout paginates' '
        rm -f pager_used &&
 -      (
 -              GIT_PAGER="wc >pager_used" &&
 -              export GIT_PAGER &&
 -              test_terminal git format-patch --stdout --all
 -      ) &&
 +      test_terminal env GIT_PAGER="wc >pager_used" git format-patch --stdout --all &&
        test_path_is_file pager_used
  '
  
   test_expect_success TTY 'format-patch --stdout pagination can be disabled' '
        rm -f pager_used &&
 -      (
 -              GIT_PAGER="wc >pager_used" &&
 -              export GIT_PAGER &&
 -              test_terminal git --no-pager format-patch --stdout --all &&
 -              test_terminal git -c "pager.format-patch=false" format-patch --stdout --all
 -      ) &&
 +      test_terminal env GIT_PAGER="wc >pager_used" git --no-pager format-patch --stdout --all &&
 +      test_terminal env GIT_PAGER="wc >pager_used" git -c "pager.format-patch=false" format-patch --stdout --all &&
        test_path_is_missing pager_used &&
        test_path_is_missing .git/pager_used
  '