fix(hooks): pre-commit hook warns instead of failing on flush error
Fixes GH#483 - The pre-commit hook was blocking commits when `bd sync --flush-only` failed, even if the user had removed beads from their branch. This made it impossible to commit on branches that don't have beads configured. Changes: - Change "Error:" to "Warning:" in the message - Remove `exit 1` so commits proceed even if flush fails - Add comments explaining why we don't block commits 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# bd-hooks-version: 0.24.2
|
# bd-hooks-version: 0.29.0
|
||||||
#
|
#
|
||||||
# bd (beads) pre-commit hook
|
# bd (beads) pre-commit hook
|
||||||
#
|
#
|
||||||
@@ -29,10 +29,12 @@ fi
|
|||||||
# Flush pending changes to JSONL
|
# Flush pending changes to JSONL
|
||||||
# Use --flush-only to skip git operations (we're already in a git hook)
|
# Use --flush-only to skip git operations (we're already in a git hook)
|
||||||
# Suppress output unless there's an error
|
# Suppress output unless there's an error
|
||||||
|
# Note: We warn but don't fail - this allows commits to proceed even if
|
||||||
|
# beads has issues (e.g., user removed .beads from their branch)
|
||||||
if ! bd sync --flush-only >/dev/null 2>&1; then
|
if ! bd sync --flush-only >/dev/null 2>&1; then
|
||||||
echo "Error: Failed to flush bd changes to JSONL" >&2
|
echo "Warning: Failed to flush bd changes to JSONL" >&2
|
||||||
echo "Run 'bd sync --flush-only' manually to diagnose" >&2
|
echo "Run 'bd sync --flush-only' manually to diagnose" >&2
|
||||||
exit 1
|
# Don't block the commit - user may have removed beads or have other issues
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stage all tracked JSONL files (issues.jsonl is canonical, beads.jsonl for backward compat, deletions.jsonl for deletion propagation)
|
# Stage all tracked JSONL files (issues.jsonl is canonical, beads.jsonl for backward compat, deletions.jsonl for deletion propagation)
|
||||||
|
|||||||
@@ -46,10 +46,12 @@ fi
|
|||||||
# Flush pending changes to JSONL
|
# Flush pending changes to JSONL
|
||||||
# Use --flush-only to skip git operations (we're already in a git hook)
|
# Use --flush-only to skip git operations (we're already in a git hook)
|
||||||
# Suppress output unless there's an error
|
# Suppress output unless there's an error
|
||||||
|
# Note: We warn but don't fail - this allows commits to proceed even if
|
||||||
|
# beads has issues (e.g., user removed .beads from their branch)
|
||||||
if ! bd sync --flush-only >/dev/null 2>&1; then
|
if ! bd sync --flush-only >/dev/null 2>&1; then
|
||||||
echo "Error: Failed to flush bd changes to JSONL" >&2
|
echo "Warning: Failed to flush bd changes to JSONL" >&2
|
||||||
echo "Run 'bd sync --flush-only' manually to diagnose" >&2
|
echo "Run 'bd sync --flush-only' manually to diagnose" >&2
|
||||||
exit 1
|
# Don't block the commit - user may have removed beads or have other issues
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stage all tracked JSONL files (issues.jsonl is canonical, beads.jsonl for backward compat, deletions.jsonl for deletion propagation)
|
# Stage all tracked JSONL files (issues.jsonl is canonical, beads.jsonl for backward compat, deletions.jsonl for deletion propagation)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# bd-hooks-version: 0.22.2
|
# bd-hooks-version: 0.29.0
|
||||||
#
|
#
|
||||||
# bd (beads) pre-commit hook
|
# bd (beads) pre-commit hook
|
||||||
#
|
#
|
||||||
@@ -46,10 +46,12 @@ fi
|
|||||||
# Flush pending changes to JSONL
|
# Flush pending changes to JSONL
|
||||||
# Use --flush-only to skip git operations (we're already in a git hook)
|
# Use --flush-only to skip git operations (we're already in a git hook)
|
||||||
# Suppress output unless there's an error
|
# Suppress output unless there's an error
|
||||||
|
# Note: We warn but don't fail - this allows commits to proceed even if
|
||||||
|
# beads has issues (e.g., user removed .beads from their branch)
|
||||||
if ! bd sync --flush-only >/dev/null 2>&1; then
|
if ! bd sync --flush-only >/dev/null 2>&1; then
|
||||||
echo "Error: Failed to flush bd changes to JSONL" >&2
|
echo "Warning: Failed to flush bd changes to JSONL" >&2
|
||||||
echo "Run 'bd sync --flush-only' manually to diagnose" >&2
|
echo "Run 'bd sync --flush-only' manually to diagnose" >&2
|
||||||
exit 1
|
# Don't block the commit - user may have removed beads or have other issues
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stage all tracked JSONL files (beads.jsonl, issues.jsonl for backward compat, deletions.jsonl for deletion propagation)
|
# Stage all tracked JSONL files (beads.jsonl, issues.jsonl for backward compat, deletions.jsonl for deletion propagation)
|
||||||
|
|||||||
Reference in New Issue
Block a user