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

+1
View File
@@ -98,4 +98,5 @@ When you make a mistake, get corrected, or discover something about this codebas
- When a new first-run dialog is added to the web console, set its seen flag in `scripts/capture-screenshots.mjs`'s `looks.json` too: the Welcome dialog once covered the regenerated dashboard screenshots until `welcomeSeen: true` was added.
- After a sync, grep for the upstream brand word on its own too, not only the full product name: the rebrand map misses a bare brand word inside identifiers and fixtures (a `KEPT_<BRAND>_ENTRIES` constant, a `<brand>Dir` option, a `"<brand>"` test folder, an owner slug in a git remote URL), and v2.7.0's sync let all four through until the residual grep caught them.
- After a sync, grep for the upstream ticket key followed by anything, not only by digits: v2.8.0's git board fixtures built branch names as `` `feature/<KEY>-${11000 + i}-…` `` template literals, which a digits-only rewrite to `ABC-<n>` misses.
- Build test git fixtures with `gitIn` / `scrubbedEnv` from `scripts/skill-script-helpers.mjs`, never with the ambient git config: a global `core.autocrlf=true` checked fixtures out with CRLF that the scrubbed scripts then read as changed, failing `git plan switch` on Windows.
- Before deleting a test file that upstream split or removed, diff plan2code's copy against the rebranded upstream base and port the plan2code-only tests: v2.7.0's split of the web console suite would otherwise have dropped seven hardening tests (now in `scripts/test-web-console-hardening.mjs`).
+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);