fix: resolve symlinks in Instance cache to prevent duplicate contexts (#16651)

Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com>
This commit is contained in:
John Mylchreest 2026-03-11 23:26:54 +00:00 • committed by GitHub
commit f1c3a44190
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -114,8 +114,16 @@ export namespace Filesystem {
}
// We cannot rely on path.resolve() here because git.exe may come from Git Bash, Cygwin, or MSYS2, so we need to translate these paths at the boundary.
// Also resolves symlinks so that callers using the result as a cache key
// always get the same canonical path for a given physical directory.
export function resolve(p: string): string {
return normalizePath(pathResolve(windowsPath(p)))
const resolved = pathResolve(windowsPath(p))
try {
return normalizePath(realpathSync(resolved))
} catch (e) {
if (isEnoent(e)) return normalizePath(resolved)
throw e
}
}
export function windowsPath(p: string): string {