Files
52bb0f467b feat(clone): a --clone VM gets the repo as it is here
A --clone VM's clone is now seeded with a snapshot, not git push, and
gets everything a working copy has. devvm clone fetch brings it all
back, and devvm rm and clone off check it before deleting.

- Refs: every branch, tag and notes ref, and a detached HEAD.
- Uncommitted changes: staged, unstaged and untracked files; files
  skip-worktree by hand get the index's version, named.
- Operations in progress (merge, rebase, cherry-pick, revert, bisect)
  and the stash; a stash's untracked part goes as its own branch.
- The repo's settings and hooks, sent as settings only where they live
  in the repo (husky); ORIG_HEAD never goes.
- Partial clones, with their promisor remote, and messages per network
  tier when it can't be reached.
- Initialised submodules, nested ones too, each with a clone of its
  own; a submodule's own folder is refused as a top-level --clone.
  vm.json gains an optional `submodules` field.
- Git LFS both ways: objects hash-checked, written under os.Root with
  no link followed, a question past 2 GiB; the filter is set only in
  the clone's repos; git-lfs 3.8.1 in base, pinned by SHA-256.
- rm and clone off keep the VM when anything the VM has didn't come
  back, and name it.
- Every shell script embedded in Go is shellchecked.
- clone.md is a guide that leads with commands; TestUserPageProse
  covers it and coding-agents.md.

After you upgrade: base and every image on it build again once, for
git-lfs.

Fixes #40, reported by @Josuesp1620. Thanks to @dhruv1220 for #42,
which found the cause (receive-pack refusing a shallow push); its
receive.shallowUpdate setting stays in the VM's repos.

Co-authored-by: Dhruv Arora <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 11:54:42 -07:00

55 lines
1.9 KiB
Go

package msg
import (
"strings"
"testing"
)
// The constructors of the --clone copy's messages render each message:
// those that count what they name in both forms, one and other, with
// every value they take.
func TestCloneCountedMessages(t *testing.T) {
for _, n := range []int{1, 2} {
for _, m := range []M{
CloneStashAllKept(n, "/d", `"stash@{1}"`),
CloneStashOverKept(n, "/d", `"stash@{1000}"`, "1000"),
CloneTodoMissing(`"1234567"`, n, "/d"),
CloneStashUntracked("saved/devvm/stash-0", n, `"f"`, "saved/devvm/stash-0-untracked"),
CloneStashUntrackedIgnored(n, `"f"`, "saved/devvm/stash-0-untracked"),
CloneUrlsKept(n, "/d", `"odd"`),
CloneHooksKept(n, "/d", `"pre-push"`),
CloneFilteredKept(n, "/d", `"secret"`),
CloneTypechangeKept(n, "/d", `"foo"`),
CloneHooksPathKept("/d", "/etc/githooks"),
CloneUrlsUnread(n, "/d", `"odd"`),
ClonePushUrlsKept(n, "/d", `"mirror"`),
CloneHooksDirKept("/d", "/d/.git/hooks"),
CloneStashFetchFailed("stash-0"),
ClonePartialBlocked("/d", "git.example.com", "origin"),
ClonePartialUnreachable("/d", "origin", "file:///srv/r.git"),
CloneFetchPartial("."),
ClonePartialBlockedNone("/d", "git.example.com", "origin"),
ClonePartialDenied("/d", "10.0.0.5", "origin"),
ClonePartialPromisorKept(n, "/d", `"origin"`),
ClonePartialRefsKept(n, "/d", `"refs/tags/t"`),
CloneRefNoObject("refs/tags/t"),
CloneSubmoduleKept("lib"),
CopyingSubmodule("lib/deep"),
CloneSubmodulesKept("."),
CloneSubmoduleUnchecked("lib"),
CloneLfsKept(n, `"0123456789ab"`, "."),
CloneLfsBad(n, `"0123456789ab"`, "."),
CloneLfsUnfetched(n, `"0123456789ab"`, "."),
CloneLfsFailed("."),
CloneLfsStorage("."),
CloneLfsSetupFailed("."),
CloneLfsLarge(".", "2.5"),
NoTerminalLfsLarge(".", "2.5"),
} {
if text := m.Text(); text == "" || strings.Contains(text, "{{") || strings.Contains(text, "<no value>") {
t.Errorf("%s (%d): %q", m.ID(), n, text)
}
}
}
}