From 6dc83992382d17c347a30c823204646d02750fc5 Mon Sep 17 00:00:00 2001 From: Otto Date: Sun, 8 Mar 2026 00:36:44 +0100 Subject: [PATCH] Test separated ots hooks --- .ots/.attestation-cache | 13 ++ ...4cd5386431eb9d1fe1335c591452ba0b66cb6e.ots | Bin 0 -> 700 bytes .ots/commit-chain.txt | 1 + .ots/prev-commit.txt | 2 +- .ots/proof.ots | Bin 945 -> 700 bytes hooks/install.sh | 67 ++++++++-- hooks/post-commit-node | 49 +++++++ hooks/post-commit-ots | 41 ++++++ hooks/pre-commit-node | 100 ++++++++++++++ hooks/pre-commit-ots | 125 ++++++++++++++++++ test11.txt | 1 + 11 files changed, 386 insertions(+), 13 deletions(-) create mode 100644 .ots/094cd5386431eb9d1fe1335c591452ba0b66cb6e.ots create mode 100755 hooks/post-commit-node create mode 100755 hooks/post-commit-ots create mode 100755 hooks/pre-commit-node create mode 100755 hooks/pre-commit-ots create mode 100644 test11.txt diff --git a/.ots/.attestation-cache b/.ots/.attestation-cache index 7de6bd9..1ba9498 100644 --- a/.ots/.attestation-cache +++ b/.ots/.attestation-cache @@ -57,3 +57,16 @@ f4eb0ad6782d2bc003206521cc66ea370dcccd9f:pending:1772900280 4bf5ab21764bc9a4507e25e0bc8de2989d4febad:pending:1772900281 e2d0ff03529b0a34146dbd97c3ebbb2b2f6d1faa:pending:1772900282 a7c0f825be4491ecec199ca7b983ee46525853e5:pending:1772900283 +392ee723c3cf626d0e5281aa94771d7133bb345e:pending:1772925243 +db6f29e01a33d8ed8f127ff169d9f91d55e8a229:pending:1772925244 +4a6f5ed0c12315b0bc8a0fa5815ada1bd20e5963:pending:1772925245 +46aded7b9582bbed673843e2cf8a3f8fa742ad91:pending:1772925245 +c0685dabfb48360a3abc103b75357f94e9f054b2:pending:1772925246 +810d26b7af9c5d306e77fec290d360c7ac876b2e:pending:1772925247 +3b54e0cb8c611d3f3525ad2386368f60200891f1:pending:1772925248 +ed2cd259e918344c5a21ecf884b3178b4256ea74:pending:1772925249 +f4eb0ad6782d2bc003206521cc66ea370dcccd9f:pending:1772925250 +4bf5ab21764bc9a4507e25e0bc8de2989d4febad:pending:1772925251 +e2d0ff03529b0a34146dbd97c3ebbb2b2f6d1faa:pending:1772925251 +a7c0f825be4491ecec199ca7b983ee46525853e5:pending:1772925252 +02143e59edb79ecf121c99f4518ad232625f5df6:pending:1772925253 diff --git a/.ots/094cd5386431eb9d1fe1335c591452ba0b66cb6e.ots b/.ots/094cd5386431eb9d1fe1335c591452ba0b66cb6e.ots new file mode 100644 index 0000000000000000000000000000000000000000..d9ae0ccd2efde0dd6712d4fb78bbc31979e0394a GIT binary patch literal 700 zcmZSZFG$S`$;?eHE=kNSC}v;?D9X=IW7yyM=tawmNmCd(7H={5_<3^>`~9maIWsaR zTP3$K9|Qs$*RW_j_1;(z zcCK%6;DOy79~3(0w{P#>s=VN7=tMc?#1vkuaQhi0clvD}@13rmaN+(Uj*l#vYc_g( z;Hcx=KSftvMwg-a{$pOfpFDlaN*N_31;tkS`bj0pddZ17sd*`hML#}FLt3bVSkvQ}mm%SAYTH`Q zzTdO8$K=L^J_`}tOYC~yzDaWPoR_QfwT@0J_U6mu?wS1cQ;hMOh3EHthkHW#WV)Gc&VgxgPw45w zJdv1_nVhPJ;+1@0B$U7-K`*~39q6A&y4(J&Kf?JA=pX4Xw;w)>QAxknBeXDIXp=C< zM}_^OSqAb<#?viQY}ikSRjL`?_+fSYqk-j%)0qeTWck)YT;l$LWBx+XUD6SG_u($l z(T2GsDL;vjJ3a_}(n?DfJ9O`*9iLyv>&$%*fp*X9U%NHPvhmMJ8|ClGuk9t%j4wQQ z&(Cz9RNQJT@W;L$s6^`jgUb^uJOtHWG%HTDcTvt?v23M@TmQxA>9_6~X&Fp~J1=m< oO2*fTyIA4Q)6{@DFD)}KFBKTOun12rNiE9DEU7F9Mms3Z0r9pz)&Kwi literal 0 HcmV?d00001 diff --git a/.ots/commit-chain.txt b/.ots/commit-chain.txt index b42f52a..392bce1 100644 --- a/.ots/commit-chain.txt +++ b/.ots/commit-chain.txt @@ -1,3 +1,4 @@ +02143e59edb79ecf121c99f4518ad232625f5df6:a7c0f825be4491ecec199ca7b983ee46525853e5 a7c0f825be4491ecec199ca7b983ee46525853e5:e2d0ff03529b0a34146dbd97c3ebbb2b2f6d1faa e2d0ff03529b0a34146dbd97c3ebbb2b2f6d1faa:4bf5ab21764bc9a4507e25e0bc8de2989d4febad 4bf5ab21764bc9a4507e25e0bc8de2989d4febad:f4eb0ad6782d2bc003206521cc66ea370dcccd9f diff --git a/.ots/prev-commit.txt b/.ots/prev-commit.txt index 253c46a..9d540e0 100644 --- a/.ots/prev-commit.txt +++ b/.ots/prev-commit.txt @@ -1 +1 @@ -a7c0f825be4491ecec199ca7b983ee46525853e5 +02143e59edb79ecf121c99f4518ad232625f5df6 diff --git a/.ots/proof.ots b/.ots/proof.ots index 9ed45da2b6e9c4b78248b7a02135f6dc04b10d94..d9ae0ccd2efde0dd6712d4fb78bbc31979e0394a 100644 GIT binary patch delta 489 zcmdnUzK3;!V*TPR1|L6f4r0H5H6>?8=7dWfKgCXMk4)2ue`2zIoA0Y<9|UZLuHC=( zOY51>#;=D~s7$@c@&AKBVB;DVji=rl3&PIzEe<@eo8yB*=lu5V-CLCxJPn;Fr<|C= zYZY!kqvTG%&Evh()e|n|pyG~a*BJMpkqJ;&sh4F2-8 z|ED=V2z=?@vxjRPAlCFa=4D9uo7%RPv+wt8?J>D=q0fTD z-}|_|zaCIYA#am6!?ORbUz%?#-{x1nu4U=F$RyYKrkC9Vje9*Q$v`ER(Gt6!w{Mc% zJm=-=e66F?ioN;rxO*ml{S+f^{AS_#J>TK(Q$Cq)W}9I3DS4`?LNC z=R2V5q`%yL_$)>x{aTOE!hE4k!W0c z9`uvtTMIGP{R7ARg`&HpBl7M~c4jiq5cs5(mMnJY-b*_^zmC_L`yK*Kn%BQ}YmjB* zpOZGq-;-b4OQsoLc-80fMmV*IR delta 742 zcmdnPx{-Z?Vtq!KP45-spwdmQzh9V}z1(S}@z5YI@cgN2 zcGR=|e%|vBIWFM%|3Sd)n68hfUsH=Hs6wov-Rr*<~s^)-Tv~sH|w-Xoc9Ya%;NZ{5cJo_++gp? z_a*Ujr8P40>!bK<`G1=HV?8k;<7s8NKgd0I_De0Cr>?d{D_Eb!_-DyBrAeFo&G};u zE^NBKO@>?I4^YXDDLZrJd3$e8++j~V2$@Z8ifqu;+75Se$A=ek>l)(EP3~keuK)jm3dNGU%6ZNTYuTOJUa7L?>#^ycaGRqKIn1mL zOMlDIeE%`8-cO!BoylJqb?Z6)^KifUvw|@VXjbkfJ?Vd!T-)vEIaj`X-+$@KoXk~c z_X&wOSgEk2M1AlDD*5ktc$>I;pJ2s~-<6+>jBM^)SU2O<7pI!`dwdoO2A+LDCFjZw zoVc`EIK9p}U$vUMNy581%{cuk=P#xz9@Ds^TNHp^eUf3Ke%WS1*QcHJQap-rKkosx zId(pq(6>6{IM1Wm_rHdlOg;8&^NL3cBV5HK8O~Mm#Igc|!!Mw=fN^(5q+#$D*6w_* zbPel;Y;4CAbRIb7SYDRh_XTK*$-TE}+{J-9Z|tNU;`HCWY^&IFtD;-*k6VJ*_R0g_ V_rQZA?Dt>CFxBgf-IEg-EdYjMT4?|P diff --git a/hooks/install.sh b/hooks/install.sh index c96c932..3de1a6e 100755 --- a/hooks/install.sh +++ b/hooks/install.sh @@ -1,6 +1,6 @@ #!/bin/bash # Git OpenTimestamp Hooks Installer -# Copies self-contained hooks to git repository +# Detects available tools and installs matching hooks set -e @@ -9,21 +9,50 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$REPO_PATH" -# Verify we're in a git repository if ! git rev-parse --git-dir > /dev/null 2>&1; then echo "Error: not a git repository" >&2 exit 1 fi HOOKS_DIR="$(git rev-parse --git-dir)/hooks" +MODE="" -echo "Installing OpenTimestamp hooks to: $HOOKS_DIR" +# Detect available tools +if command -v ots &> /dev/null; then + MODE="ots" + echo "Detected: ots CLI" +elif command -v node &> /dev/null && node -e "require('@opentimestamps/ots')" &> /dev/null 2>&1; then + MODE="node" + echo "Detected: @opentimestamps/ots (Node.js)" + echo "Note: Node version creates local proofs only (no calendar submission)" + echo "" + + # Install node package locally if not already present + if [ ! -d "node_modules/@opentimestamps" ]; then + echo "Installing @opentimestamps/ots locally..." + npm install @opentimestamps/ots + echo "✓ Package installed" + fi +else + echo "Error: Neither ots CLI nor @opentimestamps/ots found" >&2 + echo "Install one of:" >&2 + echo " pipx install opentimestamps-client (recommended)" >&2 + echo " npm install @opentimestamps/ots (local proofs only)" >&2 + exit 1 +fi -# Copy hooks -cp "$SCRIPT_DIR/post-commit" "$HOOKS_DIR/post-commit" -cp "$SCRIPT_DIR/pre-commit" "$HOOKS_DIR/pre-commit" +echo "" +echo "Installing $MODE hooks to: $HOOKS_DIR" + +# Copy appropriate hooks +if [ "$MODE" = "ots" ]; then + cp "$SCRIPT_DIR/post-commit-ots" "$HOOKS_DIR/post-commit" + cp "$SCRIPT_DIR/pre-commit-ots" "$HOOKS_DIR/pre-commit" +else + cp "$SCRIPT_DIR/post-commit-node" "$HOOKS_DIR/post-commit" + cp "$SCRIPT_DIR/pre-commit-node" "$HOOKS_DIR/pre-commit" +fi -# Make executable chmod +x "$HOOKS_DIR/post-commit" "$HOOKS_DIR/pre-commit" echo "✓ Post-commit hook installed" @@ -32,19 +61,33 @@ echo "✓ Pre-commit backfill hook installed" # Setup .gitignore GITIGNORE=".gitignore" if [ ! -f "$GITIGNORE" ]; then - echo ".ots/.attestation-cache" > "$GITIGNORE" + cat > "$GITIGNORE" << 'EOF' +.ots/.attestation-cache +node_modules/ +EOF echo "✓ Created .gitignore" elif ! grep -q ".ots/.attestation-cache" "$GITIGNORE"; then - echo "" >> "$GITIGNORE" echo ".ots/.attestation-cache" >> "$GITIGNORE" + if [ "$MODE" = "node" ] && ! grep -q "node_modules/" "$GITIGNORE"; then + echo "node_modules/" >> "$GITIGNORE" + fi echo "✓ Updated .gitignore" fi +echo "" +echo "Mode: $MODE" +if [ "$MODE" = "ots" ]; then + echo " - Full Bitcoin attestation via calendars" + echo " - Proofs submitted to remote calendars" +else + echo " - Local proofs only (no calendar submission)" + echo " - For full attestation, use: pipx install opentimestamps-client" +fi + echo "" echo "Next steps:" -echo "1. Make a test commit to verify hooks work" -echo "2. Commit the .ots/ directory: git add .ots/" -echo "3. Commit with message: git commit -m 'Add OpenTimestamp proofs'" +echo "1. Make a test commit" +echo "2. Commit proofs: git add .ots/ && git commit -m 'Add OpenTimestamp proofs'" echo "" echo "To uninstall:" echo " rm $HOOKS_DIR/post-commit $HOOKS_DIR/pre-commit" diff --git a/hooks/post-commit-node b/hooks/post-commit-node new file mode 100755 index 0000000..06bb92b --- /dev/null +++ b/hooks/post-commit-node @@ -0,0 +1,49 @@ +#!/bin/bash +# Git OpenTimestamp Post-Commit Hook (Node.js version) +# Requires: @opentimestamps/ots (npm install) + +set -e + +OUTPUT_DIR=".ots" +OUTPUT_FILE="$OUTPUT_DIR/proof.ots" + +mkdir -p "$OUTPUT_DIR" + +COMMIT_HASH=$(git rev-parse HEAD) + +# Generate proof using Node.js +node -e " +const ots = require('@opentimestamps/ots'); +const fs = require('fs'); +const hash = '$COMMIT_HASH'; +const output = '$OUTPUT_FILE'; +const hashBuffer = Buffer.from(hash, 'hex'); + +ots.Timestamp.hash(hashBuffer).then(timestamp => { + // Note: This creates a local proof only, not submitted to calendars + // For full Bitcoin attestation, use the ots CLI version + const proof = { + hash: hash, + timestamp: new Date().toISOString(), + status: 'pending', + note: 'Local proof only - use ots CLI for calendar submission' + }; + fs.writeFileSync(output, JSON.stringify(proof, null, 2)); + console.log('[ots-node] Generated local proof: ' + hash.substring(0, 8)); +}).catch(err => { + console.error('[ots-node] Error:', err.message); + process.exit(1); +}); +" + +# Save previous commit for chaining +PREV_COMMIT=$(git rev-parse HEAD^1 2>/dev/null || echo "") +if [ -n "$PREV_COMMIT" ]; then + echo "$PREV_COMMIT" > "$OUTPUT_DIR/prev-commit.txt" +fi + +# Create individual proof file (JSON format for node version) +INDIVIDUAL_PROOF="$OUTPUT_DIR/${COMMIT_HASH}.ots" +cp "$OUTPUT_FILE" "$INDIVIDUAL_PROOF" + +echo "[ots-node] Proof generated successfully" diff --git a/hooks/post-commit-ots b/hooks/post-commit-ots new file mode 100755 index 0000000..776cc89 --- /dev/null +++ b/hooks/post-commit-ots @@ -0,0 +1,41 @@ +#!/bin/bash +# Git OpenTimestamp Post-Commit Hook (ots CLI version) +# Requires: opentimestamps-client (pipx install opentimestamps-client) + +set -e + +OUTPUT_DIR=".ots" +OUTPUT_FILE="$OUTPUT_DIR/proof.ots" + +mkdir -p "$OUTPUT_DIR" + +COMMIT_HASH=$(git rev-parse HEAD) + +# Generate proof using ots CLI +temp_file=$(mktemp) +temp_ots="${temp_file}.ots" + +python3 -c "import sys; sys.stdout.buffer.write(bytes.fromhex('$COMMIT_HASH'))" > "$temp_file" +ots stamp "$temp_file" 2>/dev/null + +if [ -f "$temp_ots" ]; then + mv "$temp_ots" "$OUTPUT_FILE" + rm -f "$temp_file" + echo "[ots] Generated proof: ${COMMIT_HASH:0:8}" +else + rm -f "$temp_file" + echo "[ots] Warning: Failed to generate proof" >&2 + exit 0 +fi + +# Save previous commit for chaining +PREV_COMMIT=$(git rev-parse HEAD^1 2>/dev/null || echo "") +if [ -n "$PREV_COMMIT" ]; then + echo "$PREV_COMMIT" > "$OUTPUT_DIR/prev-commit.txt" +fi + +# Create individual proof file +INDIVIDUAL_PROOF="$OUTPUT_DIR/${COMMIT_HASH}.ots" +cp "$OUTPUT_FILE" "$INDIVIDUAL_PROOF" + +echo "[ots] Proof generated successfully" diff --git a/hooks/pre-commit-node b/hooks/pre-commit-node new file mode 100755 index 0000000..76d033e --- /dev/null +++ b/hooks/pre-commit-node @@ -0,0 +1,100 @@ +#!/bin/bash +# Git OpenTimestamp Pre-Commit Backfill Hook (Node.js version) +# Requires: @opentimestamps/ots (npm install) +# Note: Node version only generates local proofs, no calendar submission + +set -e + +OUTPUT_DIR=".ots" +STATUS_CACHE="$OUTPUT_DIR/.attestation-cache" + +mkdir -p "$OUTPUT_DIR" + +# Initialize cache +if [ ! -f "$STATUS_CACHE" ]; then + echo "# Format: commit-hash:status:timestamp" > "$STATUS_CACHE" +fi + +get_cached_status() { + local commit="$1" + local cache_line=$(grep "^$commit:" "$STATUS_CACHE" 2>/dev/null | tail -1) + if [ -n "$cache_line" ]; then + local status=$(echo "$cache_line" | cut -d: -f2) + local timestamp=$(echo "$cache_line" | cut -d: -f3) + local now=$(date +%s) + if [ "$((now - timestamp))" -lt 3600 ]; then + echo "$status" + return 0 + fi + fi + return 1 +} + +cache_status() { + local commit="$1" + local status="$2" + echo "$commit:$status:$(date +%s)" >> "$STATUS_CACHE" +} + +generate_proof_node() { + local hash="$1" + local output="$2" + + node -e " +const ots = require('@opentimestamps/ots'); +const fs = require('fs'); +const hash = '$hash'; +const output = '$output'; +const hashBuffer = Buffer.from(hash, 'hex'); + +ots.Timestamp.hash(hashBuffer).then(timestamp => { + const proof = { hash: hash, timestamp: new Date().toISOString(), status: 'pending' }; + fs.writeFileSync(output, JSON.stringify(proof, null, 2)); +}).catch(err => { console.error('Error:', err); process.exit(1); }); +" +} + +echo "[ots-node] Backfilling proofs (local only, no calendar)..." + +COMMITS=$(git rev-list --reverse HEAD) +TOTAL=$(echo "$COMMITS" | wc -l) +CURRENT=0 +UPDATED=0 + +for COMMIT in $COMMITS; do + CURRENT=$((CURRENT + 1)) + PROOF_FILE="$OUTPUT_DIR/${COMMIT}.ots" + + if [ $CURRENT -le 3 ] || [ $CURRENT -eq $TOTAL ]; then + echo "[ots-node] Processing $CURRENT/$TOTAL: ${COMMIT:0:8}" + elif [ $CURRENT -eq 4 ]; then + echo "[ots-node] ... processing remaining ..." + fi + + if [ -f "$PROOF_FILE" ]; then + # Node version doesn't support upgrade, just check cache + CACHED_STATUS=$(get_cached_status "$COMMIT" || echo "") + [ "$CACHED_STATUS" = "attested" ] && continue + + # Mark as pending (node can't attest) + cache_status "$COMMIT" "pending" + else + if generate_proof_node "$COMMIT" "$PROOF_FILE"; then + cache_status "$COMMIT" "pending" + UPDATED=$((UPDATED + 1)) + fi + fi +done + +# Update latest proof +LATEST_COMMIT=$(git rev-parse HEAD) +[ -f "$OUTPUT_DIR/${LATEST_COMMIT}.ots" ] && cp "$OUTPUT_DIR/${LATEST_COMMIT}.ots" "$OUTPUT_DIR/proof.ots" + +# Save commit chain +rm -f "$OUTPUT_DIR/commit-chain.txt" +git rev-list HEAD | while read COMMIT; do + PREV=$(git rev-parse ${COMMIT}^1 2>/dev/null || echo "") + [ -n "$PREV" ] && echo "$COMMIT:$PREV" >> "$OUTPUT_DIR/commit-chain.txt" +done + +echo "[ots-node] Backfill complete: $UPDATED generated (local proofs only)" diff --git a/hooks/pre-commit-ots b/hooks/pre-commit-ots new file mode 100755 index 0000000..65d354d --- /dev/null +++ b/hooks/pre-commit-ots @@ -0,0 +1,125 @@ +#!/bin/bash +# Git OpenTimestamp Pre-Commit Backfill Hook (ots CLI version) +# Requires: opentimestamps-client (pipx install opentimestamps-client) + +set -e + +OUTPUT_DIR=".ots" +STATUS_CACHE="$OUTPUT_DIR/.attestation-cache" + +mkdir -p "$OUTPUT_DIR" + +# Initialize cache +if [ ! -f "$STATUS_CACHE" ]; then + echo "# Format: commit-hash:status:timestamp" > "$STATUS_CACHE" +fi + +get_cached_status() { + local commit="$1" + local cache_line=$(grep "^$commit:" "$STATUS_CACHE" 2>/dev/null | tail -1) + if [ -n "$cache_line" ]; then + local status=$(echo "$cache_line" | cut -d: -f2) + local timestamp=$(echo "$cache_line" | cut -d: -f3) + local now=$(date +%s) + if [ "$((now - timestamp))" -lt 3600 ]; then + echo "$status" + return 0 + fi + fi + return 1 +} + +cache_status() { + local commit="$1" + local status="$2" + echo "$commit:$status:$(date +%s)" >> "$STATUS_CACHE" +} + +generate_proof() { + local hash="$1" + local output="$2" + local temp_file=$(mktemp) + local temp_ots="${temp_file}.ots" + + python3 -c "import sys; sys.stdout.buffer.write(bytes.fromhex('$hash'))" > "$temp_file" + ots stamp "$temp_file" 2>/dev/null + + if [ -f "$temp_ots" ]; then + mv "$temp_ots" "$output" + rm -f "$temp_file" + return 0 + fi + rm -f "$temp_file" + return 1 +} + +is_attested() { + local proof_file="$1" + local pending_count=$(ots info "$proof_file" 2>&1 | grep -c "PendingAttestation" || echo "0") + [ "$pending_count" -eq 0 ] +} + +upgrade_proof() { + local proof_file="$1" + ots upgrade "$proof_file" 2>/dev/null +} + +echo "[ots] Backfilling proofs..." + +COMMITS=$(git rev-list --reverse HEAD) +TOTAL=$(echo "$COMMITS" | wc -l) +CURRENT=0 +UPDATED=0 + +for COMMIT in $COMMITS; do + CURRENT=$((CURRENT + 1)) + PROOF_FILE="$OUTPUT_DIR/${COMMIT}.ots" + + if [ $CURRENT -le 3 ] || [ $CURRENT -eq $TOTAL ]; then + echo "[ots] Processing $CURRENT/$TOTAL: ${COMMIT:0:8}" + elif [ $CURRENT -eq 4 ]; then + echo "[ots] ... processing remaining ..." + fi + + if [ -f "$PROOF_FILE" ]; then + CACHED_STATUS=$(get_cached_status "$COMMIT" || echo "") + + [ "$CACHED_STATUS" = "attested" ] && continue + + if is_attested "$PROOF_FILE"; then + cache_status "$COMMIT" "attested" + continue + fi + + cache_status "$COMMIT" "pending" + + CACHE_LINE=$(grep "^$COMMIT:" "$STATUS_CACHE" | tail -1) + CACHE_TIME=$(echo "$CACHE_LINE" | cut -d: -f3) + CACHE_AGE=$(($(date +%s) - CACHE_TIME)) + + [ "$CACHE_AGE" -lt 600 ] && continue + + if upgrade_proof "$PROOF_FILE"; then + cache_status "$COMMIT" "attested" + UPDATED=$((UPDATED + 1)) + fi + else + if generate_proof "$COMMIT" "$PROOF_FILE"; then + cache_status "$COMMIT" "pending" + UPDATED=$((UPDATED + 1)) + fi + fi +done + +# Update latest proof +LATEST_COMMIT=$(git rev-parse HEAD) +[ -f "$OUTPUT_DIR/${LATEST_COMMIT}.ots" ] && cp "$OUTPUT_DIR/${LATEST_COMMIT}.ots" "$OUTPUT_DIR/proof.ots" + +# Save commit chain +rm -f "$OUTPUT_DIR/commit-chain.txt" +git rev-list HEAD | while read COMMIT; do + PREV=$(git rev-parse ${COMMIT}^1 2>/dev/null || echo "") + [ -n "$PREV" ] && echo "$COMMIT:$PREV" >> "$OUTPUT_DIR/commit-chain.txt" +done + +echo "[ots] Backfill complete: $UPDATED updated" diff --git a/test11.txt b/test11.txt new file mode 100644 index 0000000..0ef48fe --- /dev/null +++ b/test11.txt @@ -0,0 +1 @@ +# Test new ots-only hooks