@@ -12,7 +12,7 @@ import * as Path from "effect/Path";
1212
1313import * as ProcessRunner from "../processRunner.ts" ;
1414import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts" ;
15- import { explicitBareRepositoryEnv } from "../vcs/VcsProcess.ts" ;
15+ import { explicitBareRepositoryEnv , unsetInheritedRepositoryEnv } from "../vcs/VcsProcess.ts" ;
1616import * as HostProcess from "@t3tools/shared/HostProcess" ;
1717
1818const DEFAULT_REPOSITORY_IDENTITY_CACHE_CAPACITY = 512 ;
@@ -147,12 +147,17 @@ class RepositoryIdentityCacheKey extends Data.Class<{
147147 readonly isBare : boolean ;
148148} > { }
149149
150+ const gitEnv = ( platform : NodeJS . Platform ) : NodeJS . ProcessEnv => ( {
151+ ...unsetInheritedRepositoryEnv ( process . env , platform ) ,
152+ ...explicitBareRepositoryEnv ( process . env , platform ) ,
153+ } ) ;
154+
150155const resolveRepositoryIdentityCacheKey = Effect . fn ( "RepositoryIdentityResolver.resolveCacheKey" ) (
151156 function * ( cwd : string ) {
152157 const processRunner = yield * ProcessRunner . ProcessRunner ;
153158 const fileSystem = yield * FileSystem . FileSystem ;
154159 const path = yield * Path . Path ;
155- const env = explicitBareRepositoryEnv ( process . env , yield * HostProcess . Platform ) ;
160+ const env = gitEnv ( yield * HostProcess . Platform ) ;
156161
157162 // `git -C` cannot enter a missing folder or a file, so every probe below would fail.
158163 const isFolder = yield * fileSystem . stat ( cwd ) . pipe (
@@ -241,7 +246,7 @@ const resolveRepositoryIdentityFromCacheKey = Effect.fn(
241246 . run ( {
242247 command : "git" ,
243248 args : [ "-C" , cacheKey . rootPath , ...( cacheKey . isBare ? [ "--git-dir=." ] : [ ] ) , "remote" , "-v" ] ,
244- env : explicitBareRepositoryEnv ( process . env , yield * HostProcess . Platform ) ,
249+ env : gitEnv ( yield * HostProcess . Platform ) ,
245250 timeoutBehavior : "timedOutResult" ,
246251 } )
247252 . pipe ( Effect . option ) ;
0 commit comments