mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
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]>
41 lines
1.3 KiB
Go
41 lines
1.3 KiB
Go
package vm
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/devvmhq/devvm/internal/image"
|
|
)
|
|
|
|
// The scripts devvm builds at run time from the agents' registry pass
|
|
// shellcheck as bash, which runs them, for every agent at once and each
|
|
// alone. The structure test's TestEmbeddedScripts checks every script
|
|
// that's a constant, and lists these there (dynamicScripts).
|
|
func TestBuiltScriptsShellcheck(t *testing.T) {
|
|
sc, err := exec.LookPath("shellcheck")
|
|
if err != nil {
|
|
t.Skip("no shellcheck here")
|
|
}
|
|
scripts := map[string]string{
|
|
"agentSaveScript(all)": agentSaveScript(image.Agents),
|
|
"historyExport": historyExport(),
|
|
"historyImport": historyImport(),
|
|
}
|
|
for _, a := range image.Agents {
|
|
scripts["agentSaveScript("+a+")"] = agentSaveScript([]string{a})
|
|
}
|
|
dir := t.TempDir()
|
|
for name, s := range scripts {
|
|
file := filepath.Join(dir, "script.sh")
|
|
if err := os.WriteFile(file, []byte(s+"\n"), 0o600); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// Warnings and errors, as the structure test's TestEmbeddedScripts.
|
|
if out, err := exec.CommandContext(t.Context(), sc, "-s", "bash", "-S", "warning", file).CombinedOutput(); err != nil { //nolint:gosec // shellcheck, on the test's own file
|
|
t.Errorf("%s: shellcheck -s bash -S warning:\n%s", name, out)
|
|
}
|
|
}
|
|
}
|