Files
beads/cmd/bd/templates/hooks/post-checkout
Steve Yegge 23fce6ea49 fix: add version marker to post-checkout hook and include in CheckGitHooks
The post-checkout hook was missing the bd-hooks-version marker that the other
hooks have, and it wasn't being checked by CheckGitHooks(). This caused
version mismatch issues during hook status checks.

Changes:
- Added 'bd-hooks-version: 0.23.1' marker to post-checkout hook
- Updated CheckGitHooks() to include post-checkout in the list of hooks to check

This ensures all four git hooks (pre-commit, post-merge, pre-push, post-checkout)
have consistent version tracking.

Fixes bd-kb4g

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 14:58:03 -08:00

41 lines
882 B
Bash
Executable File

#!/usr/bin/env bash
# bd-hooks-version: 0.23.1
#
# Beads post-checkout hook
# Automatically imports JSONL to SQLite database after checking out branches
#
# Install: cp examples/git-hooks/post-checkout .git/hooks/post-checkout && chmod +x .git/hooks/post-checkout
# Arguments provided by git:
# $1 = ref of previous HEAD
# $2 = ref of new HEAD
# $3 = flag (1 if branch checkout, 0 if file checkout)
# Only run on branch checkouts
if [[ "$3" != "1" ]]; then
exit 0
fi
set -e
# Check if bd is installed
if ! command -v bd &> /dev/null; then
exit 0
fi
# Check if issues.jsonl exists
if [[ ! -f .beads/issues.jsonl ]]; then
exit 0
fi
# Import issues from JSONL
echo "🔗 Importing beads issues from JSONL..."
if bd import -i .beads/issues.jsonl 2>/dev/null; then
echo "✓ Beads issues imported successfully"
else
echo "Warning: bd import failed"
fi
exit 0