Merge branch 'jk/tests-write-script'
authorJunio C Hamano <gitster@pobox.com>
Fri, 10 Feb 2012 22:07:42 +0000 (14:07 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Feb 2012 22:07:42 +0000 (14:07 -0800)
* jk/tests-write-script:
t0300: use write_script helper
tests: add write_script helper function

1  2 
t/test-lib.sh
diff --combined t/test-lib.sh
index b22bee7c8448542cdadac36e7ac91b71a63aa7c2,a089a188641f47a24e9018d852a3089aaf47d345..e28d5fdebe21f33b91942ce00125cc215f6427fd
@@@ -64,8 -64,7 +64,8 @@@ GIT_AUTHOR_NAME='A U Thor
  GIT_COMMITTER_EMAIL=committer@example.com
  GIT_COMMITTER_NAME='C O Mitter'
  GIT_MERGE_VERBOSITY=5
 -export GIT_MERGE_VERBOSITY
 +GIT_MERGE_AUTOEDIT=no
 +export GIT_MERGE_VERBOSITY GIT_MERGE_AUTOEDIT
  export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
  export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
  export EDITOR
@@@ -330,19 -329,6 +330,19 @@@ test_tick () 
        export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
  }
  
 +# Stop execution and start a shell. This is useful for debugging tests and
 +# only makes sense together with "-v".
 +#
 +# Be sure to remove all invocations of this command before submitting.
 +
 +test_pause () {
 +      if test "$verbose" = t; then
 +              "$SHELL_PATH" <&6 >&3 2>&4
 +      else
 +              error >&5 "test_pause requires --verbose"
 +      fi
 +}
 +
  # Call test_commit with the arguments "<message> [<file> [<contents>]]"
  #
  # This will commit a file with the given contents and the given commit
@@@ -395,11 -381,20 +395,20 @@@ test_config () 
        git config "$@"
  }
  
  test_config_global () {
        test_when_finished "test_unconfig --global '$1'" &&
        git config --global "$@"
  }
  
+ write_script () {
+       {
+               echo "#!${2-"$SHELL_PATH"}" &&
+               cat
+       } >"$1" &&
+       chmod +x "$1"
+ }
  # Use test_set_prereq to tell that a particular prerequisite is available.
  # The prerequisite can later be checked for in two ways:
  #