chiark / gitweb /
Tests: debpolicy-newreject: Explicitly check the state of the repo after each operation
[dgit.git] / tests / lib
index 377c5fd1e4dd93a71bef4ff4d1fbf438e3fa65d1..fd06097bd090bf186826c14eced3b78573d5a315 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -175,6 +175,28 @@ t-archive () {
        (set -e; cd $tmp/extract; dpkg-source -x ../mirror/pool/main/$dscf)
 }
 
+t-git-dir-time-passes () {
+       touch -d 'last year' $tmp/git/$p.git
+}
+
+t-git-dir-check () {
+       local gitdir=$tmp/git/$p.git
+       case "$1" in
+       enoent)
+               if test -e "$gitdir"; then fail "$gitdir exists"; fi
+               return
+               ;;
+       public) wantstat='7[75]5' ;;
+       secret) wantstat='7[70]0' ;;
+       *)      fail "$1 t-git-dir-check ?" ;;
+       esac
+       gotstat=`stat -c%a $gitdir`
+       case "$gotstat" in
+       *$wantstat) return ;;
+       *)      fail "$gitdir has mode $gotstat, expected $wantstat" ;;
+       esac
+}
+
 t-dgit () {
        local dgit=${DGIT_TEST-dgit}
        : '