credential-libsecret: unlock locked secrets
[gitweb.git] / t / test-lib-functions.sh
index 4f7eadb5963e7d698f9ee6e265b1657e543cdb44..adab7f51f4c962967c90e3184853377feece2b1e 100644 (file)
@@ -81,6 +81,10 @@ test_decode_color () {
        '
 }
 
+lf_to_nul () {
+       perl -pe 'y/\012/\000/'
+}
+
 nul_to_q () {
        perl -pe 'y/\000/Q/'
 }
@@ -990,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 &&
+               "$@"
+       )
+}