Merge branch 'pb/test-must-fail-is-for-git'
[gitweb.git] / t / test-lib-functions.sh
index 579e812506ec7cf0ea48aeb70991592fa7616f29..bd357704cce987afa79ec8fce038aa05f8c0a762 100644 (file)
@@ -1004,3 +1004,17 @@ test_copy_bytes () {
                }
        ' - "$1"
 }
+
+# run "$@" inside a non-git directory
+nongit () {
+       test -d non-repo ||
+       mkdir non-repo ||
+       return 1
+
+       (
+               GIT_CEILING_DIRECTORIES=$(pwd) &&
+               export GIT_CEILING_DIRECTORIES &&
+               cd non-repo &&
+               "$@"
+       )
+}