mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
rm on a clone VM now fetches the VM's unfetched branches into new local branches, saved/<remote>/<branch>, and removes the remote fully with git remote remove (its remote-tracking branches and upstream settings too). Before removing it, any of the remote's remote-tracking branches with commits no other ref has (fetched by hand, or with rm -f) are kept the same way, in one update-ref transaction that never overwrites. The prefix is saved/<remote>, else saved/<remote>-2 up to -99: the first that no local branch is, is in or holds. Remote names devvm picks start with devvm, so these never shadow a later VM's remote-tracking branches. No free prefix: rm refuses before fetching (saved_names_taken), and at deletion the remote stays (remote_kept). Branch names from the VM are checked with git check-ref-format, passed only as argv, and shown quoted; invalid ones are skipped (branch_names_invalid). The fetch uses --no-tags. A branch counts as fetched only when a ref reaches its commit, not merely when the object exists. Inventory: - vm: fetchUnfetched, validBranch, savedPrefix, quoted, saveFetched; unfetchedRefs reads full refnames and checks reachability; removeRemote saves, then git remote remove - messages: branch_names_invalid, saved_names_taken, saved_branches, remote_kept; fetch_before_delete and fetching take prefix; removed_remote and unfetched_commits reworded. Doc links: saved_names_taken, remote_kept - tests: TestCloneRm (saved/devvm/main, no remote-tracking refs left, a dangling commit unfetched), TestFetchUnfetchedInvalid, TestSavedPrefix, TestRemoveRemote (unique branches saved under saved/devvm-2, upstream gone, no free names keeps the remote); clone.txtar: rm -f keeps fetched-only work as saved/devvm/main - e2e: clone's rm -f check wants saved/devvm/main and no remote-tracking branches - docs: clone.md, commands.md Co-Authored-By: Claude Opus 5.5 <[email protected]>