fix: guard against init-sentinel refs from empty remote repos
A freshly created remote repo returns branch head values like 'init-sha256:<12-hex>' to signal the branch has no commits yet. The push command was passing these directly to commit_exists() → split_id(), which raised ValueError (hex portion not 64 chars).
Fix: add _is_valid_commit_id() which wraps split_id() in a try/except and returns False for any malformed ID. Guard both call sites in run() that pass remote ref values to commit_exists() — the candidate_have filter and the branch_have construction.
Tests: TestT13InitSentinel (4 tests) covering crash guard, sentinel filtering from have list, valid refs alongside sentinel, and empty branch_heads.
sha256:9e28bb3830e4cae4a4e709426bf311c0f9f0423d826798e3f2618cb2d15e3101
sha
+8
~2
symbols
sha256:3ea38320d8f536678f99c42480e3f43f2c77773e2006e00cf31e8a96b3bf8d2d
snapshot
+8
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes
10 symbols
+
test_init_sentinel_not_included_in_have_list
method
method test_init_sentinel_not_included_in_have_list L798–810
+
test_other_valid_refs_still_included_in_have
method
method test_other_valid_refs_still_included_in_have L812–827
+
test_push_to_empty_remote_does_not_crash
method
method test_push_to_empty_remote_does_not_crash L787–796
0 comments
To add a comment, use the Muse CLI:
muse hub commit comment sha256:9e28bb3830e4cae4a4e709426bf311c0f9f0423d826798e3f2618cb2d15e3101 --body "your comment"
No comments yet. Be the first to start the discussion.