summaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index fdaeb3a96b..adab7f51f4 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -994,3 +994,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 &&
+ "$@"
+ )
+}