fix(hooks): add --no-daemon to git hook sync commands (bd-tyyn) (#948)
Fix git hooks failing when daemon is running Git hooks were calling bd sync without --no-daemon, causing inline import to fail with 'no database store available' because daemon mode only initializes daemonClient. Fix: Add --no-daemon to all bd sync calls in git hooks to ensure direct mode.
This commit is contained in:
@@ -499,7 +499,8 @@ func runPreCommitHook() int {
|
|||||||
|
|
||||||
// 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)
|
||||||
cmd := exec.Command("bd", "sync", "--flush-only")
|
// Use --no-daemon to ensure direct mode (inline import requires local store)
|
||||||
|
cmd := exec.Command("bd", "sync", "--flush-only", "--no-daemon")
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Warning: Failed to flush bd changes to JSONL")
|
fmt.Fprintln(os.Stderr, "Warning: Failed to flush bd changes to JSONL")
|
||||||
fmt.Fprintln(os.Stderr, "Run 'bd sync --flush-only' manually to diagnose")
|
fmt.Fprintln(os.Stderr, "Run 'bd sync --flush-only' manually to diagnose")
|
||||||
@@ -572,7 +573,8 @@ func runPostMergeHook() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run bd sync --import-only --no-git-history
|
// Run bd sync --import-only --no-git-history
|
||||||
cmd := exec.Command("bd", "sync", "--import-only", "--no-git-history")
|
// Use --no-daemon to ensure direct mode (inline import requires local store)
|
||||||
|
cmd := exec.Command("bd", "sync", "--import-only", "--no-git-history", "--no-daemon")
|
||||||
output, err := cmd.CombinedOutput()
|
output, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Warning: Failed to sync bd changes after merge")
|
fmt.Fprintln(os.Stderr, "Warning: Failed to sync bd changes after merge")
|
||||||
@@ -613,7 +615,8 @@ func runPrePushHook() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Flush pending bd changes
|
// Flush pending bd changes
|
||||||
flushCmd := exec.Command("bd", "sync", "--flush-only")
|
// Use --no-daemon to ensure direct mode (inline import requires local store)
|
||||||
|
flushCmd := exec.Command("bd", "sync", "--flush-only", "--no-daemon")
|
||||||
_ = flushCmd.Run() // Ignore errors
|
_ = flushCmd.Run() // Ignore errors
|
||||||
|
|
||||||
// Check for uncommitted JSONL changes
|
// Check for uncommitted JSONL changes
|
||||||
@@ -710,7 +713,8 @@ func runPostCheckoutHook(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run bd sync --import-only --no-git-history
|
// Run bd sync --import-only --no-git-history
|
||||||
cmd := exec.Command("bd", "sync", "--import-only", "--no-git-history")
|
// Use --no-daemon to ensure direct mode (inline import requires local store)
|
||||||
|
cmd := exec.Command("bd", "sync", "--import-only", "--no-git-history", "--no-daemon")
|
||||||
output, err := cmd.CombinedOutput()
|
output, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Warning: Failed to sync bd changes after checkout")
|
fmt.Fprintln(os.Stderr, "Warning: Failed to sync bd changes after checkout")
|
||||||
|
|||||||
Reference in New Issue
Block a user