Test commit with pre-commit backfill
This commit is contained in:
parent
c0685dabfb
commit
810d26b7af
6 changed files with 150 additions and 6 deletions
|
|
@ -1,10 +1,11 @@
|
|||
#!/bin/bash
|
||||
# install-ots-hook.sh - Install OpenTimestamp post-commit hook
|
||||
# Usage: install-ots-hook.sh [repository-path]
|
||||
# Usage: install-ots-hook.sh [repository-path] [backfill]
|
||||
|
||||
set -e
|
||||
|
||||
REPO_PATH="${1:-.}"
|
||||
ENABLE_BACKFILL="${2:-}" # Second arg: "backfill" to enable pre-commit backfill hook
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
cd "$REPO_PATH"
|
||||
|
|
@ -18,7 +19,7 @@ fi
|
|||
HOOKS_DIR="$(git rev-parse --git-dir)/hooks"
|
||||
POST_COMMIT_HOOK="$HOOKS_DIR/post-commit"
|
||||
|
||||
echo "Installing OpenTimestamp hook in: $REPO_PATH"
|
||||
echo "Installing OpenTimestamp hooks in: $REPO_PATH"
|
||||
|
||||
# Create the post-commit hook
|
||||
cat > "$POST_COMMIT_HOOK" << 'HOOK_SCRIPT'
|
||||
|
|
@ -66,10 +67,23 @@ HOOK_SCRIPT
|
|||
chmod +x "$POST_COMMIT_HOOK"
|
||||
|
||||
echo "✓ Post-commit hook installed successfully"
|
||||
|
||||
# Optionally install pre-commit backfill hook
|
||||
if [ "$ENABLE_BACKFILL" = "backfill" ]; then
|
||||
PRE_COMMIT_HOOK="$HOOKS_DIR/pre-commit"
|
||||
cp "$SCRIPT_DIR/pre-commit-backfill" "$PRE_COMMIT_HOOK"
|
||||
chmod +x "$PRE_COMMIT_HOOK"
|
||||
echo "✓ Pre-commit backfill hook installed (will backfill proofs before each commit)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Ensure generate-proof.sh is accessible (copy to repo root or install skill globally)"
|
||||
echo "1. Ensure scripts are accessible (copy to repo root or install skill globally)"
|
||||
echo "2. Verify ots CLI or @opentimestamps/ots is installed"
|
||||
echo "3. Make a test commit to verify the hook works"
|
||||
echo "3. Make a test commit to verify the hooks work"
|
||||
echo ""
|
||||
echo "To uninstall, run: rm $POST_COMMIT_HOOK"
|
||||
echo "To uninstall:"
|
||||
echo " rm $POST_COMMIT_HOOK"
|
||||
if [ "$ENABLE_BACKFILL" = "backfill" ]; then
|
||||
echo " rm $PRE_COMMIT_HOOK"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue