Run test fixtures' git under the scripts' scrubbed config, so a global core.autocrlf no longer fails git plan switch

AI Assisted
This commit is contained in:
jparkerweb committed 2026-10-14 20:17:18 -07:00
1 parent 68d1f82a2e
commit 498e09bb15
2 files changed
+7 -2

No files matched your search

+6 -2
View File
@@ -83,8 +83,12 @@ export function write(root, rel, content) {
export const read = (root, rel) => fs.readFileSync(path.join(root, rel), "utf8");
/** A git runner for `dir`. */
export const gitIn = (dir) => (...a) => execFileSync("git", a, { cwd: dir, stdio: "pipe", encoding: "utf8" });
/**
* A git runner for `dir`, under the same scrubbed config the scripts get: with
* the ambient config, a global core.autocrlf=true checks files out with CRLF
* that the scripts (autocrlf off) then read as changed.
*/
export const gitIn = (dir) => (...a) => execFileSync("git", a, { cwd: dir, stdio: "pipe", encoding: "utf8", env: scrubbedEnv() });
export function gitInit(dir, branch = "main") {
const g = gitIn(dir);