Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

gitConfig.setup.ts

20 lines906 Bytes

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