Created
June 29, 2026 19:29
-
-
Save lukehinds/6a45590812b0518765e3787f70973c93 to your computer and use it in GitHub Desktop.
nono-pr1298-repro.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| tmp="$(mktemp -d /private/tmp/nono-pr1298-repro.XXXXXX)" | |
| main="$tmp/main" | |
| wt="$tmp/linked" | |
| profile="$tmp/profile.json" | |
| cleanup() { | |
| printf 'repro dir left at: %s\n' "$tmp" | |
| } | |
| trap cleanup EXIT | |
| mkdir -p "$main" | |
| git init "$main" >/dev/null | |
| git -C "$main" -c user.email=test@test.com -c user.name=Test \ | |
| commit --allow-empty -m init >/dev/null | |
| git -C "$main" worktree add "$wt" HEAD >/dev/null | |
| printf '%s\n' \ | |
| '{"meta":{"name":"test"},"filesystem":{"allow":["@git:common-dir"]}}' \ | |
| > "$profile" | |
| expected="$(cd "$main/.git" && pwd)" | |
| printf 'expected grant: %s\n' "$expected" | |
| printf 'workdir: %s\n' "$wt" | |
| printf 'profile: %s\n\n' "$profile" | |
| printf 'profile json:\n' | |
| sed 's/^/ /' "$profile" | |
| printf '\n' | |
| output="$( | |
| cargo run -p nono-cli -- run --dry-run --profile "$profile" --workdir "$wt" -- echo ok 2>&1 | |
| )" | |
| printf '%s\n' "$output" | rg '\.git|r\+w' || true | |
| printf '\n' | |
| if printf '%s\n' "$output" | rg -q "r\+w[[:space:]]+$expected \(dir\)"; then | |
| printf 'PASS: @git:common-dir resolved against --workdir.\n' | |
| else | |
| printf 'FAIL: @git:common-dir did not resolve to the --workdir repo common dir.\n' | |
| printf ' It likely resolved against the process cwd instead.\n' | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment