

























@@ -131,7 +131,7 @@ describe("installPluginFromGitSpec", () => {
131131const cloneArgv = commandArgvAt(0);
132132expect(cloneArgv.slice(0, 3)).toEqual(["git", "clone", "https://github.com/acme/demo.git"]);
133133expect(cloneArgv[3]).toContain("/repo");
134-expect(commandArgvAt(1)).toEqual(["git", "checkout", "--detach", "v1.2.3"]);
134+expect(commandArgvAt(1)).toEqual(["git", "switch", "--detach", "--", "v1.2.3"]);
135135expect(commandArgvAt(3)).toEqual([
136136"npm",
137137"install",
@@ -252,6 +252,30 @@ describe("installPluginFromGitSpec", () => {
252252expect(installPluginFromInstalledPackageDirMock).not.toHaveBeenCalled();
253253});
254254255+it("separates requested refs from git options", async () => {
256+runCommandWithTimeoutMock
257+.mockResolvedValueOnce({ code: 0, stdout: "", stderr: "" })
258+.mockResolvedValueOnce({
259+code: 128,
260+stdout: "",
261+stderr: "fatal: invalid reference: --ignore-skip-worktree-bits",
262+});
263+264+const result = await installPluginFromGitSpec({
265+spec: "git:github.com/acme/demo@--ignore-skip-worktree-bits",
266+});
267+268+expect(result.ok).toBe(false);
269+expect(commandArgvAt(1)).toEqual([
270+"git",
271+"switch",
272+"--detach",
273+"--",
274+"--ignore-skip-worktree-bits",
275+]);
276+expect(installPluginFromInstalledPackageDirMock).not.toHaveBeenCalled();
277+});
278+255279it("keeps the existing managed repo when replacement install fails", async () => {
256280const gitDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-git-install-preserve-"));
257281const normalizedSpec = "git:https://github.com/acme/demo.git";
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。