gabriel / muse public
Closed #7
filed by gabriel human · 23 days ago

muse merge does not resolve remote tracking refs (origin/main syntax)

0 Anchors
Blast radius
Churn 30d
0 Proposals

Bug

After muse fetch origin, the remote tracking ref is correctly stored at .muse/remotes/origin/main. But muse merge origin/main fails:

❌ Branch 'origin/main' has no commits.

get_head_commit_id calls validate_branch_name which rejects the slash, then raises — the remote tracking ref is never consulted.

The same gap affects any command that resolves a branch ref: muse merge, muse merge-base, muse log --all, muse branch -a.

Expected behaviour (idiomatic)

After muse fetch origin:

  • muse merge origin/main resolves origin/main.muse/remotes/origin/main → commit ID
  • muse branch -a --json lists remote tracking branches alongside local ones
  • muse log --all --json includes commits reachable from remote tracking refs

Fix

Add a resolve_tracking_ref(root, ref) helper that, when a ref contains /, splits on the first / and reads .muse/remotes/<remote>/<branch>. Thread this through get_head_commit_id (or a new resolve_any_ref wrapper) and the merge command's branch resolution.

TDD

Write failing tests in muse/tests/test_remote_tracking_refs.py that:

  1. Assert muse merge origin/main exits 0 after a fetch
  2. Assert muse branch -a --json includes origin/main in the output
  3. Assert muse log --all --json includes the fetched commit

Then make them green.

Activity1
gabriel opened this issue 23 days ago
gabriel 23 days ago

Fixed in dev. 7/7 tests green.

  • resolve_any_ref() added to store.py — tries local branch first, then .muse/remotes/<remote>/<branch> for both origin/main and remotes/origin/main syntax
  • muse merge origin/main now resolves correctly after fetch
  • muse log --all --json now walks remote tracking tips; _branch_tips(include_remote=True) also used in the graph render

TDD: tests written first, all 7 failed, all 7 now green.