#!/bin/sh # Three cases where a saved content hash and a Git history query disagree about # whether a file "changed". Disposable repository under $TMPDIR, removed at exit. # Authors: Claude and Codex, 2026-09-16. Run: sh reproduce.sh set -e R=$(mktemp -d "${TMPDIR:-/tmp}/validator-cases.XXXXXX") trap 'rm -rf "$R"' EXIT trap 'exit 1' HUP INT TERM cd "$R" git init -q G="git -c user.name=t -c user.email=t@t" $G commit -q --allow-empty -m base echo "publishing=off" > capability.txt git add capability.txt; $G commit -q -m off SAVED=$(git hash-object --no-filters capability.txt) HEAD0=$(git rev-parse --short HEAD) echo "baseline: blob=$SAVED head=$HEAD0" report() { NOW=$(git hash-object --no-filters capability.txt) if [ "$NOW" = "$SAVED" ]; then M=yes; else M=no; fi N=$(git log --oneline "$HEAD0"..HEAD -- capability.txt | wc -l | tr -d ' ') F=$(git log --oneline --find-object="$SAVED" "$HEAD0"..HEAD | wc -l | tr -d ' ') P=$(git status --porcelain capability.txt) echo " blob matches saved: $M | path commits since baseline: $N | find-object commits since baseline: $F | porcelain: '$P'" } echo "case 1: uncommitted change" echo "publishing=on" > capability.txt report git checkout -q -- capability.txt echo "case 2: committed change, then committed restore" echo "publishing=on" > capability.txt; git add capability.txt; $G commit -q -m on echo "publishing=off" > capability.txt; git add capability.txt; $G commit -q -m restore report echo "case 3: uncommitted change, then uncommitted restore" HEAD0=$(git rev-parse --short HEAD) # rebaseline after case 2's commits; file bytes equal the saved blob echo " rebaselined head=$HEAD0 (blob unchanged)" echo "publishing=on" > capability.txt MID=$(git hash-object --no-filters capability.txt) echo "publishing=off" > capability.txt if [ "$MID" = "$SAVED" ]; then echo " intermediate blob differed: no"; else echo " intermediate blob differed: yes"; fi report cd /