gabriel / muse public
fix patch commit task/commit-all-deletions #1 / 1
AI Agent gabriel · 162 days ago · Apr 18, 2026 · Diff

fix(commit): allow committing when only staged deletions remain

Two-part bug discovered during muse rm test ride:

1. commit refused with 'nothing tracked' when all tracked files were staged for deletion via muse rm. The empty snapshot is intentional in this case. Fix: check for staged deletions before emitting the empty-workdir error.

2. apply_manifest raised ValueError (empty manifest + non-empty workdir) when called after an all-deletions commit, crashing after the branch ref was already written. Files kept with --cached would have been incorrectly deleted. Fix: skip apply_manifest entirely when the committed manifest is empty — there is nothing to restore, and --cached files must stay on disk as untracked.

10 new tests covering: all-deletions commit, --cached keeps files on disk, recursive rm then commit, dry-run with staged deletions, JSON output.

sha256:53c0a0b0f8c1462fd758464b1695ccea7d09e72c31ced6d204dd47ecf7c42af0 sha
+13 ~1 symbols
sha256:b764df19076060a747bcc674b748000ad7dc28b03d42f2d1658a05c458f74404 snapshot
+13
symbols added
~1
symbol modified
0
dead code introduced
Semantic Changes 14 symbols
~ muse/cli/commands/commit.py .py 1 symbol added, 1 symbol modified
+ read_stage import import read_stage L72–72
~ run
~ tests/test_cmd_commit.py .py 12 symbols added
+ TestCommitAllDeletions class class TestCommitAllDeletions L1016–1154
+ _committed_repo method method _committed_repo L1025–1032
+ test_all_cached_rm_then_commit_leaves_files_on_disk method method test_all_cached_rm_then_commit_leaves_files_on_disk L1140–1154
+ test_cached_rm_file_stays_on_disk_after_commit method method test_cached_rm_file_stays_on_disk_after_commit L1124–1138
+ test_commit_after_rm_all_creates_second_commit method method test_commit_after_rm_all_creates_second_commit L1042–1052
+ test_commit_after_rm_all_snapshot_is_empty method method test_commit_after_rm_all_snapshot_is_empty L1054–1065
+ test_commit_after_rm_all_succeeds method method test_commit_after_rm_all_succeeds L1034–1040
+ test_commit_after_rm_one_file_leaves_one_in_snapshot method method test_commit_after_rm_one_file_leaves_one_in_snapshot L1067–1080
+ test_dry_run_with_all_deletions_staged method method test_dry_run_with_all_deletions_staged L1116–1122
+ test_json_output_on_all_deletions_commit method method test_json_output_on_all_deletions_commit L1082–1090
+ test_recursive_rm_then_commit_succeeds method method test_recursive_rm_then_commit_succeeds L1104–1114
+ test_status_clean_after_all_deletions_commit method method test_status_clean_after_all_deletions_commit L1092–1102
← Older Oldest on task/commit-all-deletions
All commits
Newer → Latest on task/commit-all-deletions

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:53c0a0b0f8c1462fd758464b1695ccea7d09e72c31ced6d204dd47ecf7c42af0 --body "your comment"