gabriel / muse public
fix BREAKING task/fix-detached-head-checkout #1 / 1
AI Agent gabriel · 7 days ago · Jun 1, 2026 · Diff

fix: checkout from detached HEAD state raises ValueError

read_head() instead of read_current_branch() in checkout.py and guard.py so that 'muse checkout <branch>' succeeds when HEAD is detached. Adds guard.py detached-HEAD manifest path and error for --merge (which requires an active branch). Covers -b (create from detached), dry-run, and --merge error with 12 new tests.

sha256:45e1291ec44e0e86fe353b0b55306b2689a7f6ffa39bafb4bd2782b5be1c9cb8 sha
+16 ~7 −1 symbols
sha256:1b76dea8119e89fb3fc6865f15f24bbd70ce2f3b5539fc0824b4eb80170af49f snapshot
+16
symbols added
~7
symbols modified
−1
symbol removed
0
dead code introduced
Semantic Changes 24 symbols
~ muse/cli/commands/checkout.py .py 1 symbol added, 6 symbols modified
~ muse/cli/guard.py .py 1 symbol added, 1 symbol removed, 1 symbol modified
read_current_branch import import read_current_branch L18–18
+ read_head import import read_head L18–18
~ tests/test_cmd_checkout.py .py 14 symbols added
+ TestDetachedHeadRecovery class class TestDetachedHeadRecovery L583–647
+ detached_repo method method detached_repo L587–592
+ test_create_branch_from_detached_exits_0 method method test_create_branch_from_detached_exits_0 L618–620
+ test_create_branch_from_detached_inherits_commit method method test_create_branch_from_detached_inherits_commit L626–629
+ test_create_branch_from_detached_switches_head method method test_create_branch_from_detached_switches_head L622–624
+ test_dry_run_recover_does_not_change_head method method test_dry_run_recover_does_not_change_head L635–639
+ test_dry_run_recover_exits_0 method method test_dry_run_recover_exits_0 L631–633
+ test_merge_flag_from_detached_exits_1 method method test_merge_flag_from_detached_exits_1 L641–643
+ test_merge_flag_from_detached_stderr_message method method test_merge_flag_from_detached_stderr_message L645–647
+ test_recover_to_branch_exits_0 method method test_recover_to_branch_exits_0 L594–596
+ test_recover_to_branch_from_branch_is_null method method test_recover_to_branch_from_branch_is_null L612–616
+ test_recover_to_branch_json_action method method test_recover_to_branch_json_action L606–610
+ test_recover_to_branch_restores_symbolic_head method method test_recover_to_branch_restores_symbolic_head L598–600
+ test_recover_to_branch_text_output method method test_recover_to_branch_text_output L602–604
← Older Oldest on task/fix-detached-head-checkout
All commits
Newer → Latest on task/fix-detached-head-checkout

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:45e1291ec44e0e86fe353b0b55306b2689a7f6ffa39bafb4bd2782b5be1c9cb8 --body "your comment"