interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / tests / receipt_commit.sh

24 lines · 1298 bytes Raw Blame History
1#!/bin/sh
2# tests/receipt_commit.sh -- commit identity for generated qualification receipts.
3# Sourced by the gate runners. Sets QUALIFIED_COMMIT to the commit the tree is actually at and
4# fails closed when a caller passes a different sha or the tree is dirty, so a receipt can never
5# carry the identity of a commit whose bytes it did not come from (the M8/M9 defect from 469f53c1).
6# RECEIPT_COMMIT stays a placeholder: a receipt cannot know the commit that will contain it.
7receipt_commit_resolve() {
8 _root=$1
9 _head=$(git -C "$_root" rev-parse --verify HEAD 2>/dev/null) || {
10 echo "receipt_commit: $_root is not a git checkout; refusing to stamp a receipt" >&2
11 return 1
12 }
13 if [ -n "$(git -C "$_root" status --porcelain --untracked-files=no -- src tools tests 2>/dev/null)" ]; then
14 echo "receipt_commit: src/, tools/ or tests/ differ from HEAD $_head; commit first" >&2
15 return 1
16 fi
17 if [ -n "${QUALIFIED_IMPLEMENTATION_COMMIT:-}" ] && [ "$QUALIFIED_IMPLEMENTATION_COMMIT" != "$_head" ]; then
18 echo "receipt_commit: QUALIFIED_IMPLEMENTATION_COMMIT=$QUALIFIED_IMPLEMENTATION_COMMIT is not HEAD $_head" >&2
19 return 1
20 fi
21 QUALIFIED_COMMIT=$_head
22 RECEIPT_COMMIT="${RECEIPT_COMMIT:-pending-receipt-commit}"
23 return 0
24}