Fix bd-my64: Pre-push hook blocks instead of exports
The original pre-push hook tried to export DB → JSONL during the push, then run 'git add', but this doesn't work because: 1. The commit is already created when pre-push runs 2. git add in pre-push stages files for a FUTURE commit 3. The current push sends the old commit with stale JSONL 4. Result: dirty git status after push Fix: - Pre-push now CHECKS for uncommitted JSONL changes - If found, it FAILS the push with clear instructions - User must commit JSONL before pushing - This prevents stale JSONL from reaching remote The pre-commit hook already properly flushes changes, so this catch-all prevents changes made BETWEEN commit and push. Amp-Thread-ID: https://ampcode.com/threads/T-39a89553-c301-4d4f-b39f-6df9c403d22b Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
# bd (beads) pre-commit hook
|
||||
#
|
||||
# This hook ensures that any pending bd issue changes are flushed to
|
||||
# .beads/issues.jsonl before the commit is created, preventing the
|
||||
# .beads/beads.jsonl before the commit is created, preventing the
|
||||
# race condition where daemon auto-flush fires after the commit.
|
||||
#
|
||||
# Installation:
|
||||
@@ -35,9 +35,17 @@ if ! bd sync --flush-only >/dev/null 2>&1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Find the JSONL file (could be issues.jsonl or beads.jsonl)
|
||||
JSONL_FILE=""
|
||||
if [ -f .beads/beads.jsonl ]; then
|
||||
JSONL_FILE=".beads/beads.jsonl"
|
||||
elif [ -f .beads/issues.jsonl ]; then
|
||||
JSONL_FILE=".beads/issues.jsonl"
|
||||
fi
|
||||
|
||||
# If the JSONL file was modified, stage it
|
||||
if [ -f .beads/issues.jsonl ]; then
|
||||
git add .beads/issues.jsonl 2>/dev/null || true
|
||||
if [ -n "$JSONL_FILE" ] && [ -f "$JSONL_FILE" ]; then
|
||||
git add "$JSONL_FILE" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user