Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

test(git): isolate remote-authority assertions from operator git config

Abdurrahman Fakhrul328d6caec4f6
diff --git a/scripts/update-remote-authority.test.ts b/scripts/update-remote-authority.test.ts
index 1f4f25b8..32890cd1 100644
--- a/scripts/update-remote-authority.test.ts
+++ b/scripts/update-remote-authority.test.ts
@@ -7,8 +7,13 @@ import { afterEach, describe, expect, it } from "vitest";
const HELPER = new URL("./lib/update-remote-authority.sh", import.meta.url);
const roots: string[] = [];
+// An operator's global git config can rewrite URLs (`url.<base>.insteadOf`),
+// which would make these assertions depend on the machine instead of on the
+// helper under test. Point every git call at no config at all.
+const HERMETIC_ENV = { ...process.env, GIT_CONFIG_GLOBAL: "/dev/null", GIT_CONFIG_SYSTEM: "/dev/null", GIT_CONFIG_NOSYSTEM: "1" };
+
function git(cwd: string, ...args: string[]) {
- return execFileSync("git", args, { cwd, encoding: "utf8" }).trim();
+ return execFileSync("git", args, { cwd, encoding: "utf8", env: HERMETIC_ENV }).trim();
}
function repo(origin: string) {
@@ -20,7 +25,7 @@ function repo(origin: string) {
}
function prepare(root: string) {
- execFileSync("bash", ["-c", 'source "./lib/update-remote-authority.sh"; update_prepare_origin "$1"', "_", root], { cwd: new URL(".", import.meta.url), encoding: "utf8" });
+ execFileSync("bash", ["-c", 'source "./lib/update-remote-authority.sh"; update_prepare_origin "$1"', "_", root], { cwd: new URL(".", import.meta.url), encoding: "utf8", env: HERMETIC_ENV });
return git(root, "remote", "get-url", "origin");
}