Merge branch 'jl/submodule-tests'
authorJunio C Hamano <gitster@pobox.com>
Mon, 21 Jul 2014 18:18:30 +0000 (11:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Jul 2014 18:18:31 +0000 (11:18 -0700)
* jl/submodule-tests:
revert: add t3513 for submodule updates
stash: add t3906 for submodule updates
am: add t4255 for submodule updates
cherry-pick: add t3512 for submodule updates
pull: add t5572 for submodule updates
rebase: add t3426 for submodule updates
merge: add t7613 for submodule updates
bisect: add t6041 for submodule updates
reset: add t7112 for submodule updates
read-tree: add t1013 for submodule updates
apply: add t4137 for submodule updates
checkout: call the new submodule update test framework
submodules: add the lib-submodule-update.sh test library
test-lib: add test_dir_is_empty()

1  2 
t/test-lib-functions.sh
diff --combined t/test-lib-functions.sh
index 0377d3e2960cc282ce1a2c7cb629245728c82092,acd9a55cacf9d4c825e3f2e7b1b229aa995677f1..dafd6ad21a92bac48155af39ebb9a4baaf3c4970
@@@ -489,6 -489,17 +489,17 @@@ test_path_is_dir () 
        fi
  }
  
+ # Check if the directory exists and is empty as expected, barf otherwise.
+ test_dir_is_empty () {
+       test_path_is_dir "$1" &&
+       if test -n "$(ls -a1 "$1" | egrep -v '^\.\.?$')"
+       then
+               echo "Directory '$1' is not empty, it contains:"
+               ls -la "$1"
+               return 1
+       fi
+ }
  test_path_is_missing () {
        if [ -e "$1" ]
        then
@@@ -542,7 -553,7 +553,7 @@@ test_must_fail () 
        if test $exit_code = 0; then
                echo >&2 "test_must_fail: command succeeded: $*"
                return 1
 -      elif test $exit_code -gt 129 -a $exit_code -le 192; then
 +      elif test $exit_code -gt 129 && test $exit_code -le 192; then
                echo >&2 "test_must_fail: died by signal: $*"
                return 1
        elif test $exit_code = 127; then
  test_might_fail () {
        "$@"
        exit_code=$?
 -      if test $exit_code -gt 129 -a $exit_code -le 192; then
 +      if test $exit_code -gt 129 && test $exit_code -le 192; then
                echo >&2 "test_might_fail: died by signal: $*"
                return 1
        elif test $exit_code = 127; then