#!/bin/sh # Recompute the public (subtree-split) commit of the forge tag thor-recipe-c-v1 and record it in fucina_split.tsv. # Deterministic, local only (sparse clone in a scratch dir, nothing is pushed). Needs git-subtree (contrib of git). set -eu HERE=$(cd "$(dirname "$0")" && pwd) REPO=${THOR_FORGE_REPO:-/home/angelo/tony-forgia} W=${THOR_SPLIT_DIR:-/tmp/claude-1000/fucina_split} SUB=${GIT_SUBTREE_DIR:-/tmp/claude-1000/gitsub/bin} rm -rf "$W"; git clone -q --shared --no-checkout "$REPO" "$W"; cd "$W" priv=$(git -C "$REPO" rev-parse 'thor-recipe-c-v1^{commit}') git sparse-checkout set fucina_en >/dev/null 2>&1; git checkout -q "$priv" pub=$(PATH="$SUB:$(git --exec-path):$PATH" git subtree split --prefix=fucina_en "$priv" 2>/dev/null) # older commits of the example setup named machine paths: rewrite them in the public history (example files only; # the code bundle keeps its bytes, its hash is pinned). Deterministic: fixed committer data from each commit. SED="$HERE/fucina_depriv.sed" [ -s "$SED" ] || { echo "missing $SED" >&2; exit 1; } rec=$(awk -F'\t' '$1=="public"{print $2}' "$HERE/fucina_split.tsv" 2>/dev/null || true) git branch -f pubsplit "$pub" >/dev/null FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' --tree-filter " for f in examples/thor/config.yaml examples/thor/models/*.yaml; do [ -f \"\$f\" ] && sed -i -f '$SED' \"\$f\"; done; true" pubsplit >/dev/null 2>&1 pub=$(git rev-parse pubsplit) t1=$(git rev-parse "$pub^{tree}"); t2=$(git rev-parse "$priv:fucina_en") [ "$t1" = "$t2" ] || { echo "tree mismatch" >&2; exit 1; } # compare with the recorded public commit and never overwrite the record (its method line is richer than this script's) if [ -n "$rec" ] && [ "$rec" != "$pub" ]; then echo "public commit $pub differs from the recorded $rec" >&2; exit 1; fi echo "public $pub (matches the record in fucina_split.tsv${rec:+: $rec})"