Skip to content

Add redo-reset command#14

Merged
dinkelk merged 3 commits into
masterfrom
feature/redo-reset
Mar 20, 2026
Merged

Add redo-reset command#14
dinkelk merged 3 commits into
masterfrom
feature/redo-reset

Conversation

@dinkelk
Copy link
Copy Markdown
Owner

@dinkelk dinkelk commented Mar 18, 2026

Summary

Adds redo-reset — a new command to clear all redo build state when the database becomes confused.

Problem

Sometimes redo's database can get confused (e.g., source files marked as targets, or stale state from incomplete builds) if a user performs actions outside of redo's purview. The only fix is rm -rf ~/.redo, which is hard to discover and easy to forget.

Solution

$ redo-reset
Resetting redo state... done.
  Removed /home/user/.redo (build state)
  Removed /tmp/redo-1001-locks (lock files)
  Removed /tmp/redo-1001 (temp/cache)
Redo state reset. Next build will start fresh.

What it removes

  • ~/.redo/ — persistent build state (database, stamps)
  • /tmp/redo-<user>-locks/ — lock files for parallel builds
  • /tmp/redo-<user>/ — session temp dirs and caches

What it does NOT remove

  • Build outputs

Design

  • Implemented as a new symlink target (same pattern as redo-ifchange, redo-done, etc.)
  • Handled early in main() before session initialization — avoids creating state it's about to delete
  • Idempotent — running twice is safe (Nothing to reset.)
  • --help and --version work as expected

Tests

11 tests in test/420-reset/all.do covering:

  1. No prior state
  2. State removal after build
  3. Meta directory removal
  4. Build works after reset
  5. Build outputs preserved
  6. Reports what was removed
  7. Multiple resets idempotent
  8. --help shows usage
  9. Rebuild from scratch after reset
  10. --version works
  11. Output format

@dinkelk dinkelk force-pushed the feature/redo-reset branch from a683fa8 to d713fa6 Compare March 20, 2026 15:00
@dinkelk dinkelk changed the title feat: add redo-reset command Add redo-reset command Mar 20, 2026
dinkelk added 3 commits March 20, 2026 09:04
New command that removes all redo build state, allowing a fresh start
when the database becomes confused (e.g., source files marked as targets).

Removes:
- ~/.redo/ (persistent build state: database, stamps)
- /tmp/redo-<user>-locks/ (lock files)
- /tmp/redo-<user>/ (session temp dirs, caches)

Does NOT remove build outputs — only redo's own state.

Includes 11 unit tests.
Lists all redo-* commands with one-line descriptions at the bottom
of 'redo -h' output for discoverability.
@dinkelk dinkelk force-pushed the feature/redo-reset branch from d713fa6 to 0f1753a Compare March 20, 2026 15:04
@dinkelk dinkelk merged commit 396e2d7 into master Mar 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant