diff --git a/scripts/generate-fixtures.sh b/scripts/generate-fixtures.sh index 94bc5ea..4e993b2 100755 --- a/scripts/generate-fixtures.sh +++ b/scripts/generate-fixtures.sh @@ -66,6 +66,30 @@ if [ -n "$__fetch_from" ]; then wget --no-verbose -O "$PROJECT_DIR/build/fixtures/user-profiles.json" "$__fetch_from/user-profiles.json" else echo "Generating fixtures..." + + # In shallow clones (e.g. `gh repo clone -- --depth 1`), or when cloning + # the public mirror — which does not contain the `data` branch — the + # `origin/data` ref may be missing locally. Try to fetch it on demand, + # and fall back to an actionable error if it is unavailable. + if ! git rev-parse --verify --quiet refs/remotes/origin/data >/dev/null; then + echo "origin/data not found locally; fetching..." + if ! git fetch --depth=1 origin data:refs/remotes/origin/data; then + cat >&2 <