#!/usr/bin/env bash
# Synthetic fixture for #25845: linked worktrees nested inside plain folders under a managed worktrees root.
# Usage: fixture-25845.sh <t3-home> <scratch-repo-dir>
set -euo pipefail
home=$1; repo=$2; root=$home/worktrees
mkdir -p "$repo" && git -C "$repo" init -q -b main
git -C "$repo" -c user.email=fixture@example.com -c user.name=fixture commit -q --allow-empty -m init
mkdir -p "$root/repo/replay" "$root/repo/deep/a" "$root/group"
git -C "$repo" worktree add -q "$root/repo/replay/1376" -b replay-1376
git -C "$repo" worktree add -q "$root/repo/replay/1377" -b replay-1377
git -C "$repo" worktree add -q "$root/repo/flat" -b flat
git -C "$repo" worktree add -q "$root/repo/deep/a/b" -b deep-ab
git -C "$repo" worktree add -q "$root/group/g1" -b g1
echo dirty > "$root/repo/replay/1376/uncommitted.txt"
# Past the report's 1h grace period.
touch -d '3 hours ago' "$root/repo/replay" "$root/repo/replay/1376" "$root/repo/replay/1377" "$root/repo/flat" \
  "$root/repo/deep" "$root/repo/deep/a" "$root/repo/deep/a/b" "$root/group" "$root/group/g1"
git -C "$repo" worktree list
