3
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2026-06-18 02:46:26 +00:00
This commit is contained in:
Drew Ballance 2026-06-03 15:36:31 +02:00 committed by GitHub
commit cc1fbca669
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 111 additions and 6 deletions

View file

@ -366,9 +366,18 @@ class GitAuthHelper {
true // globalConfig?
)
} else {
// Host git directory
let gitDir = path.join(this.git.getWorkingDirectory(), '.git')
gitDir = gitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows
// Host git directory - resolve symlinks so includeIf gitdir matching works
// on self-hosted runners where _work is a symlink to an external volume.
let gitDir: string
try {
const constructed = path.join(this.git.getWorkingDirectory(), '.git')
const resolved = await fs.promises.realpath(constructed)
gitDir = resolved.replace(/\\/g, '/')
} catch {
// Fall back to constructed path if realpath fails
gitDir = path.join(this.git.getWorkingDirectory(), '.git')
gitDir = gitDir.replace(/\\/g, '/')
}
// Configure host includeIf
const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`