#!/bin/sh
# Synthetic real GitLab fixture. Requires authenticated glab and git.
set -eu
: "${PROOF_DIR:?Set PROOF_DIR to a fresh scratch directory}"
name=t3-proof-46495-mode
id=$(glab api -X POST projects -f name="$name" -f visibility=private -f initialize_with_readme=true | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
git clone "https://gitlab.com/julius54/$name.git" "$PROOF_DIR/repo"
cd "$PROOF_DIR/repo"
printf '#!/bin/sh\necho mode-proof\n' > script.sh
git add script.sh
git -c user.name='Mode Proof' -c user.email='proof@example.com' commit -m 'Add script'
git push origin main
git switch -c chmod
git update-index --chmod=+x script.sh
git -c user.name='Mode Proof' -c user.email='proof@example.com' commit -m 'Make script executable'
git push origin chmod
glab api -X POST "projects/$id/merge_requests" -f source_branch=chmod -f target_branch=main -f title='Mode-only executable change' >/dev/null
glab api "projects/$id/merge_requests/1/diffs"
# After captures: glab api -X DELETE "projects/$id"
