#!/usr/bin/env bash
set -eu
checkout=$1
scratch=$2
mkdir -p "$scratch/sample/project" "$scratch/sample/outside"
if ! git -C "$scratch/sample/project" rev-parse --git-dir >/dev/null 2>&1; then
  git init -q "$scratch/sample/project"
  git -C "$scratch/sample/project" -c user.name=Example -c user.email=example@example.com commit -q --allow-empty -m 'Initial sample'
fi
printf '%s\n' 'Outside note: permission check succeeded.' > "$scratch/sample/outside/notes.txt"
cd "$checkout"
node apps/server/src/bin.ts project add --base-dir .t3 --title 'Permission demo' "$scratch/sample/project"
