cli

Command-line interface for Radroots
git clone https://radroots.dev/git/cli.git
Log | Files | Refs | README | LICENSE

verify-repository-boundary.sh (611B)


      1 #!/bin/sh
      2 set -eu
      3 
      4 if [ "$#" -gt 1 ]; then
      5   echo "usage: $0 [repository-root]" >&2
      6   exit 64
      7 fi
      8 
      9 if [ "$#" -eq 1 ]; then
     10   repository_root=$1
     11 else
     12   CDPATH=''
     13   export CDPATH
     14   repository_root=$(cd -- "$(dirname -- "$0")/.." && pwd -P)
     15 fi
     16 
     17 if [ ! -d "$repository_root" ]; then
     18   echo "repository root is not a directory: $repository_root" >&2
     19   exit 64
     20 fi
     21 
     22 status=0
     23 for forbidden_root in docs .github .act; do
     24   candidate=$repository_root/$forbidden_root
     25   if [ -e "$candidate" ] || [ -L "$candidate" ]; then
     26     echo "forbidden capsule root exists: $forbidden_root" >&2
     27     status=1
     28   fi
     29 done
     30 
     31 exit "$status"