Files
devvm/testdata/script
w3cjandClaude Opus 5.5 5c345b43b3 fix(clone): rm keeps fetched branches as local branches
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]>
2026-10-24 12:52:22 -06:00
..
2026-10-24 09:50:15 -06:00
2026-10-24 03:11:14 -06:00
2026-10-24 09:50:15 -06:00