Merge branch 'ep/shell-assign-and-export-vars'
authorJunio C Hamano <gitster@pobox.com>
Fri, 6 Jun 2014 18:38:51 +0000 (11:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Jun 2014 18:38:51 +0000 (11:38 -0700)
* ep/shell-assign-and-export-vars:
scripts: more "export VAR=VALUE" fixes
scripts: "export VAR=VALUE" construct is not portable

1  2 
contrib/subtree/t/t7900-subtree.sh
git-remote-testgit.sh
git-stash.sh
t/t5560-http-backend-noserver.sh
index b22b710c262ed6c55e97859aac8a2fd1c5adb219,8dc684035318c86516860cb70eef987881f3899f..6309d124ca2c97b2b1b9262c7b9470c576870069
@@@ -8,7 -8,8 +8,8 @@@ This test verifies the basic operation 
  and split subcommands of git subtree.
  '
  
- export TEST_DIRECTORY=$(pwd)/../../../t
+ TEST_DIRECTORY=$(pwd)/../../../t
+ export TEST_DIRECTORY
  
  . ../../../t/test-lib.sh
  
@@@ -76,7 -77,7 +77,7 @@@ test_expect_success 'add sub1' 
  
  # Save this hash for testing later.
  
 -subdir_hash=`git rev-parse HEAD`
 +subdir_hash=$(git rev-parse HEAD)
  
  test_expect_success 'add sub2' '
          create sub2 &&
diff --combined git-remote-testgit.sh
index 1c006a0518e247d58759df98602f6dae3935caf6,cbf470f64f0b93c520ce55d1b93c866b669bfbaa..a9c75a2360fec7a9ce5f22877a471f70bc405ff1
@@@ -13,10 -13,9 +13,11 @@@ refspec="${GIT_REMOTE_TESTGIT_REFSPEC-$
  
  test -z "$refspec" && prefix="refs"
  
- export GIT_DIR="$url/.git"
+ GIT_DIR="$url/.git"
+ export GIT_DIR
  
 +force=
 +
  mkdir -p "$dir"
  
  if test -z "$GIT_REMOTE_TESTGIT_NO_MARKS"
@@@ -41,7 -40,6 +42,7 @@@ d
                fi
                test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
                test -n "$GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE" && echo "no-private-update"
 +              echo 'option'
                echo
                ;;
        list)
@@@ -96,7 -94,6 +97,7 @@@
                before=$(git for-each-ref --format=' %(refname) %(objectname) ')
  
                git fast-import \
 +                      ${force:+--force} \
                        ${testgitmarks:+"--import-marks=$testgitmarks"} \
                        ${testgitmarks:+"--export-marks=$testgitmarks"} \
                        --quiet
  
                echo
                ;;
 +      option\ *)
 +              read cmd opt val <<-EOF
 +              $line
 +              EOF
 +              case $opt in
 +              force)
 +                      test $val = "true" && force="true" || force=
 +                      echo "ok"
 +                      ;;
 +              *)
 +                      echo "unsupported"
 +                      ;;
 +              esac
 +              ;;
        '')
                exit
                ;;
diff --combined git-stash.sh
index af549c731779db02db29fef446014a58bc9a3996,fc3005a7a2453ebd37c7efee4a082e3655037603..bcc757b3900b02595e5b432edcfd590e312b48ce
@@@ -13,7 -13,7 +13,7 @@@ USAGE="list [<options>
  
  SUBDIRECTORY_OK=Yes
  OPTIONS_SPEC=
 -START_DIR=`pwd`
 +START_DIR=$(pwd)
  . git-sh-setup
  . git-sh-i18n
  require_work_tree
@@@ -94,7 -94,8 +94,8 @@@ create_stash () 
                # ease of unpacking later.
                u_commit=$(
                        untracked_files | (
-                               export GIT_INDEX_FILE="$TMPindex"
+                               GIT_INDEX_FILE="$TMPindex" &&
+                               export GIT_INDEX_FILE &&
                                rm -f "$TMPindex" &&
                                git update-index -z --add --remove --stdin &&
                                u_tree=$(git write-tree) &&
@@@ -512,14 -513,8 +513,14 @@@ apply_stash () 
  pop_stash() {
        assert_stash_ref "$@"
  
 -      apply_stash "$@" &&
 -      drop_stash "$@"
 +      if apply_stash "$@"
 +      then
 +              drop_stash "$@"
 +      else
 +              status=$?
 +              say "The stash is kept in case you need it again."
 +              exit $status
 +      fi
  }
  
  drop_stash () {
index 5abd11a5638299f2d3fe41d38f9a3d10050a4e4b,1e25128ad30c0134313da151bae81ef32485d0dc..aa73eeaef82adff56083fdc2d5d35d599b73edee
@@@ -5,12 -5,16 +5,16 @@@ test_description='test git-http-backend
  
  HTTPD_DOCUMENT_ROOT_PATH="$TRASH_DIRECTORY"
  
- test_have_prereq GREP_STRIPS_CR && export GREP_OPTIONS=-U
+ if test_have_prereq GREP_STRIPS_CR
+ then
+       GREP_OPTIONS=-U
+       export GREP_OPTIONS
+ fi
  
  run_backend() {
        echo "$2" |
 -      QUERY_STRING="${1#*\?}" \
 -      PATH_TRANSLATED="$HTTPD_DOCUMENT_ROOT_PATH/${1%%\?*}" \
 +      QUERY_STRING="${1#*[?]}" \
 +      PATH_TRANSLATED="$HTTPD_DOCUMENT_ROOT_PATH/${1%%[?]*}" \
        git http-backend >act.out 2>act.err
  }