#!/bin/bash # setup-gitignore.sh - Create/update .gitignore for OpenTimestamp proofs # Usage: setup-gitignore.sh [repository-path] set -e REPO_PATH="${1:-.}" 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 GITIGNORE=".gitignore" # Create .gitignore if it doesn't exist if [ ! -f "$GITIGNORE" ]; then echo "# OpenTimestamp proofs cache (exclude from version control)" > "$GITIGNORE" echo ".ots/.attestation-cache" >> "$GITIGNORE" echo "" echo "Created $GITIGNORE with OpenTimestamp cache exclusion" else # Check if already has the cache exclusion if grep -q ".ots/.attestation-cache" "$GITIGNORE"; then echo "$GITIGNORE already excludes .ots/.attestation-cache" else echo "" >> "$GITIGNORE" echo "# OpenTimestamp proofs cache (exclude from version control)" >> "$GITIGNORE" echo ".ots/.attestation-cache" >> "$GITIGNORE" echo "Added .ots/.attestation-cache to $GITIGNORE" fi fi echo "" echo "Next steps:" echo "1. Review and commit your .gitignore" echo "2. Add .ots/ directory to track proofs: git add .ots/" echo "3. Commit proofs: git commit -m 'Add OpenTimestamp proofs'"