@@ -18,6 +18,8 @@ import {
1818 VcsProcessStdinWriteError ,
1919 VcsProcessTimeoutError ,
2020} from "@t3tools/contracts" ;
21+ import * as HostProcess from "@t3tools/shared/HostProcess" ;
22+
2123import * as ProcessRunner from "../processRunner.ts" ;
2224
2325export interface VcsProcessInput {
@@ -75,7 +77,7 @@ export const gitConfigEnv = (
7577 env : NodeJS . ProcessEnv ,
7678 key : string ,
7779 value : string ,
78- platform : NodeJS . Platform = process . platform ,
80+ platform : NodeJS . Platform ,
7981) : NodeJS . ProcessEnv => {
8082 const countKeys = Object . keys ( env ) . filter ( ( name ) =>
8183 platform === "win32" ? name . toUpperCase ( ) === "GIT_CONFIG_COUNT" : name === "GIT_CONFIG_COUNT" ,
@@ -106,8 +108,8 @@ export const gitConfigEnv = (
106108 * form one, so git started by T3 (or by gh and friends) only opens a bare
107109 * repository named with `--git-dir` or `GIT_DIR`. Git before 2.38 ignores it.
108110 */
109- export const explicitBareRepositoryEnv = ( env : NodeJS . ProcessEnv ) =>
110- gitConfigEnv ( env , "safe.bareRepository" , "explicit" ) ;
111+ export const explicitBareRepositoryEnv = ( env : NodeJS . ProcessEnv , platform : NodeJS . Platform ) =>
112+ gitConfigEnv ( env , "safe.bareRepository" , "explicit" , platform ) ;
111113
112114const classifyNonZeroExit = ( command : string , stderr : string ) : VcsProcessExitFailureKind => {
113115 const normalized = stderr . toLowerCase ( ) ;
@@ -162,6 +164,7 @@ const isTransientGitExit = (stderr: string) =>
162164
163165export const make = Effect . gen ( function * ( ) {
164166 const processRunner = yield * ProcessRunner . ProcessRunner ;
167+ const hostPlatform = yield * HostProcess . Platform ;
165168 const vcsProcesses = yield * Semaphore . make ( VCS_PROCESS_CONCURRENCY ) ;
166169 const githubProcesses = yield * Semaphore . make ( GITHUB_PROCESS_CONCURRENCY ) ;
167170
@@ -181,7 +184,10 @@ export const make = Effect.gen(function* () {
181184 ...( input . spawnCwd !== undefined ? { spawnCwd : input . spawnCwd } : { } ) ,
182185 ...( input . stdin !== undefined ? { stdin : input . stdin } : { } ) ,
183186 ...( input . onStdoutChunk !== undefined ? { onStdoutChunk : input . onStdoutChunk } : { } ) ,
184- env : { ...input . env , ...explicitBareRepositoryEnv ( { ...process . env , ...input . env } ) } ,
187+ env : {
188+ ...input . env ,
189+ ...explicitBareRepositoryEnv ( { ...process . env , ...input . env } , hostPlatform ) ,
190+ } ,
185191 timeout : input . timeoutMs ?? DEFAULT_TIMEOUT_MS ,
186192 maxOutputBytes : input . maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES ,
187193 outputMode : input . outputMode ?? "truncate" ,
0 commit comments