#!/bin/sh
# Clone the real half of the disposability corpus (0001 §11: sqlite, tcl)
# straight from their public fossil servers — zit speaks the fossil sync
# protocol, so no local fossil is needed. These are multi-hundred-MB
# transfers; run deliberately, never in CI's default path.
set -eu

root=$(cd "$(dirname "$0")" && pwd)
out="$root/out"
mkdir -p "$out"

command -v zit >/dev/null || { echo "zit not on PATH" >&2; exit 1; }

clone() {
	name=$1 url=$2
	if [ -d "$out/$name" ]; then
		echo "$out/$name exists; skipping (rm -rf to rebuild)"
		return
	fi
	echo "cloning $url → $out/$name"
	zit clone "$url" "$out/$name"
}

clone sqlite https://www.sqlite.org/src
clone tcl https://core.tcl-lang.org/tcl
