fix: support Git in WSL mounted workspaces
This commit is contained in:
+24
-1
@@ -154,6 +154,26 @@ describe("ssh host apply-patch fs backend", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("ssh WSL mounted workspace ownership", () => {
|
||||
test("bridges the mounted workspace owner to Git for direct and child shell commands", () => {
|
||||
const direct = parseSshInvocation("G14-WSL:/mnt/d/Work/demo", ["git", "rev-parse", "--show-toplevel"]);
|
||||
const childShell = parseSshInvocation("G14-WSL:/mnt/d/Work/demo", ["bash", "--", "git status --short"]);
|
||||
|
||||
for (const invocation of [direct, childShell]) {
|
||||
expect(invocation.parsed.remoteCommand).toContain("UNIDESK_TRANS_HOST_WORKSPACE_OWNER_UID");
|
||||
expect(invocation.parsed.remoteCommand).toContain('export SUDO_UID="$UNIDESK_TRANS_HOST_WORKSPACE_OWNER_UID"');
|
||||
expect(invocation.parsed.remoteCommand).toContain('stat -c %u .');
|
||||
}
|
||||
});
|
||||
|
||||
test("does not change ownership trust for ordinary Linux workspaces", () => {
|
||||
const invocation = parseSshInvocation("D601:/home/ubuntu/workspace/demo", ["git", "status", "--short"]);
|
||||
|
||||
expect(invocation.parsed.remoteCommand).not.toContain("UNIDESK_TRANS_HOST_WORKSPACE_OWNER_UID");
|
||||
expect(invocation.parsed.remoteCommand).not.toContain("SUDO_UID");
|
||||
});
|
||||
});
|
||||
|
||||
describe("ssh stdout bounded streaming", () => {
|
||||
test("uses YAML output policy defaults and clamps env override", () => {
|
||||
const policy = readCliOutputPolicy();
|
||||
@@ -291,7 +311,10 @@ describe("ssh backend selection", () => {
|
||||
"",
|
||||
].join("\n"));
|
||||
try {
|
||||
const plan = sshCaptureBackendPlan(minimalConfig("198.51.100.4"), { UNIDESK_TRANS_CONFIG_PATH: configPath } as NodeJS.ProcessEnv);
|
||||
const plan = sshCaptureBackendPlan(minimalConfig("198.51.100.4"), {
|
||||
UNIDESK_TRANS_CONFIG_PATH: configPath,
|
||||
UNIDESK_MAIN_SERVER_IP: "198.51.100.4",
|
||||
} as NodeJS.ProcessEnv);
|
||||
|
||||
expect(plan.backend).toBe("remote-frontend-websocket");
|
||||
expect(plan.remoteHost).toBe("198.51.100.4");
|
||||
|
||||
Reference in New Issue
Block a user