The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | // Mirrors the server's set in apps/server/src/vcs/VcsProcess.ts, which shared cannot import. |
| 2 | const REPOSITORY_SELECTORS = new Set([ |
| 3 | "GIT_DIR", |
| 4 | "GIT_WORK_TREE", |
| 5 | "GIT_COMMON_DIR", |
| 6 | "GIT_INDEX_FILE", |
| 7 | "GIT_OBJECT_DIRECTORY", |
| 8 | "GIT_ALTERNATE_OBJECT_DIRECTORIES", |
| 9 | ]); |
| 10 | |
| 11 | /** |
| 12 | * `git bisect run`, `git rebase --exec` and hooks export GIT_DIR (hooks also GIT_INDEX_FILE) to what |
| 13 | * they run, so a fixture's git commands would work on that repository instead of the one in their |
| 14 | * cwd. Spread the result into a child's env to unset them under the spelling they were inherited as. |
| 15 | */ |
| 16 | export const unsetInheritedGitRepositoryEnv = ( |
| 17 | inherited: NodeJS.ProcessEnv, |
| 18 | platform: NodeJS.Platform, |
| 19 | ): Record<string, undefined> => |
| 20 | Object.fromEntries( |
| 21 | Object.keys(inherited) |
| 22 | .filter((name) => REPOSITORY_SELECTORS.has(platform === "win32" ? name.toUpperCase() : name)) |
| 23 | .map((name) => [name, undefined]), |
| 24 | ); |