diff --git a/generate-proof.sh b/generate-proof.sh index a8c4d87..d85d70f 100755 --- a/generate-proof.sh +++ b/generate-proof.sh @@ -102,13 +102,13 @@ else exit 1 fi -# Append previous commit hash to the proof file for chaining -if [ -f "$OUTPUT_FILE" ]; then - PREV_COMMIT=$(git rev-parse HEAD^1 2>/dev/null || echo "") - if [ -n "$PREV_COMMIT" ]; then - echo "" >> "$OUTPUT_FILE" - echo "# Previous commit: $PREV_COMMIT" >> "$OUTPUT_FILE" - fi +# Get previous commit hash for chaining (before appending to proof file) +PREV_COMMIT=$(git rev-parse HEAD^1 2>/dev/null || echo "") + +# Store previous commit hash in a separate metadata file for chaining +if [ -n "$PREV_COMMIT" ]; then + echo "$PREV_COMMIT" > "$(dirname "$OUTPUT_FILE")/prev-commit.txt" + echo "Chaining info saved: $PREV_COMMIT" fi echo "Proof generated for commit: $COMMIT_HASH" diff --git a/test3.txt b/test3.txt new file mode 100644 index 0000000..8f4eebf --- /dev/null +++ b/test3.txt @@ -0,0 +1 @@ +# Test chaining