Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tests/test_receipt_commit_guard.sh # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tests / test_receipt_commit_guard.sh` 31 lines ยท 1516 bytes Raw Blame History 1 #!/bin/sh 2 # tests/test_receipt_commit_guard.sh -- receipt_commit_resolve stamps HEAD and fails closed otherwise. 3 set -u 4 ROOT=$(cd "$(dirname "$0")/.." && pwd -P) 5 . "$ROOT/tests/receipt_commit.sh" 6 HEAD=$(git -C "$ROOT" rev-parse HEAD) 7 fail() { echo "FAIL: $1"; exit 1; } 8 9 unset QUALIFIED_IMPLEMENTATION_COMMIT RECEIPT_COMMIT 10 receipt_commit_resolve "$ROOT" || fail "clean tree at HEAD refused" 11 [ "$QUALIFIED_COMMIT" = "$HEAD" ] || fail "QUALIFIED_COMMIT $QUALIFIED_COMMIT is not HEAD $HEAD" 12 [ "$RECEIPT_COMMIT" = "pending-receipt-commit" ] || fail "RECEIPT_COMMIT not a placeholder" 13 echo "PASS: HEAD $HEAD stamped" 14 15 QUALIFIED_IMPLEMENTATION_COMMIT=$HEAD receipt_commit_resolve "$ROOT" || fail "matching override refused" 16 echo "PASS: override equal to HEAD accepted" 17 18 if QUALIFIED_IMPLEMENTATION_COMMIT=`d25349e4bf4a820dbcff0dd6a593d1db7b454a0b` receipt_commit_resolve "$ROOT" 2>/dev/null; then 19 fail "foreign sha accepted" 20 fi 21 echo "PASS: foreign sha refused (negative control)" 22 23 tmp=$(mktemp -d) && trap 'rm -rf "$tmp"' EXIT 24 if receipt_commit_resolve "$tmp" 2>/dev/null; then fail "non-git directory accepted"; fi 25 echo "PASS: non-git tree refused (negative control)" 26 27 git -C "$ROOT" worktree add -q "$tmp/wt" HEAD || fail "worktree" 28 printf '\n' >> "$tmp/wt/tests/receipt_commit.sh" 29 if receipt_commit_resolve "$tmp/wt" 2>/dev/null; then git -C "$ROOT" worktree remove --force "$tmp/wt"; fail "dirty tree accepted"; fi 30 git -C "$ROOT" worktree remove --force "$tmp/wt" 31 echo "PASS: dirty tree refused (negative control)"