| 1 | // Pins git behaviour for every repository the suite creates, ahead of the |
| 2 | // host's ~/.gitconfig. Git for Windows installs with core.autocrlf=true, |
| 3 | // which checks committed LF files out as CRLF and breaks every byte-exact |
| 4 | // content assertion; a signing key or a non-default init branch on the |
| 5 | // developer's machine breaks fixtures the same way. Set as environment so |
| 6 | // each git child the driver spawns sees it without touching the fixtures. |
| 7 | const entries: ReadonlyArray<readonly [key: string, value: string]> = [ |
| 8 | ["core.autocrlf", "false"], |
| 9 | ["core.filemode", "false"], |
| 10 | ["core.longpaths", "true"], |
| 11 | ["commit.gpgsign", "false"], |
| 12 | ["tag.gpgsign", "false"], |
| 13 | ["init.defaultBranch", "main"], |
| 14 | ]; |
| 15 | |
| 16 | const existing = Number(process.env.GIT_CONFIG_COUNT ?? "0"); |
| 17 | process.env.GIT_CONFIG_COUNT = String(existing + entries.length); |
| 18 | entries.forEach(([key, value], index) => { |
| 19 | process.env[`GIT_CONFIG_KEY_${existing + index}`] = key; |
| 20 | process.env[`GIT_CONFIG_VALUE_${existing + index}`] = value; |
| 21 | }); |