fix(sync): cleanup snapshots after sync regardless of --no-pull (bd-0io)
Moved snapshot cleanup call to the end of successful sync, outside the !noPull block. This ensures snapshot files (beads.base.jsonl, beads.left.jsonl) are removed even when --no-pull is used. Previously, captureLeftSnapshot was called before the pull block, but cleanup was only inside the pull block, leaving orphaned files when --no-pull was used. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -428,20 +428,19 @@ Use --merge to merge the sync branch back to main branch.`,
|
||||
if dryRun {
|
||||
fmt.Println("\n✓ Dry run complete (no changes made)")
|
||||
} else {
|
||||
// Clean up temporary snapshot files after successful sync (bd-0io)
|
||||
// This runs regardless of whether pull was performed
|
||||
sm := NewSnapshotManager(jsonlPath)
|
||||
if err := sm.Cleanup(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Warning: failed to clean up snapshots: %v\n", err)
|
||||
}
|
||||
|
||||
// Auto-compact deletions manifest if enabled and threshold exceeded
|
||||
if err := maybeAutoCompactDeletions(ctx, jsonlPath); err != nil {
|
||||
// Non-fatal - just log warning
|
||||
fmt.Fprintf(os.Stderr, "Warning: auto-compact deletions failed: %v\n", err)
|
||||
}
|
||||
|
||||
// Clean up snapshot files after successful sync (bd-0io fix)
|
||||
// This ensures snapshots are removed even when --no-pull is used,
|
||||
// since captureLeftSnapshot is called before the pull block.
|
||||
sm := NewSnapshotManager(jsonlPath)
|
||||
if err := sm.Cleanup(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Warning: failed to clean up snapshots: %v\n", err)
|
||||
}
|
||||
|
||||
fmt.Println("\n✓ Sync complete")
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user