mirror of
https://gitea.com/actions/checkout.git
synced 2025-11-08 23:56:20 +08:00
.
This commit is contained in:
@@ -448,11 +448,29 @@ class GitAuthHelper {
|
||||
await this.removeGitConfig(this.tokenConfigKey)
|
||||
await this.removeSubmoduleGitConfig(this.tokenConfigKey)
|
||||
|
||||
// Remove includeIf
|
||||
for (const includeKey of this.credentialsIncludeKeys) {
|
||||
await this.removeGitConfig(includeKey)
|
||||
// Remove includeIf entries that point to git-credentials-*.config files
|
||||
// This is more aggressive than tracking keys, but necessary since cleanup
|
||||
// runs in a post-step where this.credentialsIncludeKeys is empty
|
||||
try {
|
||||
// Get all includeIf.gitdir keys
|
||||
const keys = await this.git.tryGetConfigKeys('^includeIf\\.gitdir:')
|
||||
|
||||
for (const key of keys) {
|
||||
// Get all values for this key
|
||||
const values = await this.git.tryGetConfigValues(key)
|
||||
if (values.length > 0) {
|
||||
// Remove only values that match git-credentials-<uuid>.config pattern
|
||||
for (const value of values) {
|
||||
if (/git-credentials-[0-9a-f-]+\.config$/i.test(value)) {
|
||||
await this.git.tryConfigUnsetValue(key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
// Ignore errors - this is cleanup code
|
||||
core.debug(`Error during includeIf cleanup: ${err}`)
|
||||
}
|
||||
this.credentialsIncludeKeys = []
|
||||
|
||||
// Remove submodule includeIf
|
||||
await this.git.submoduleForeach(
|
||||
|
||||
Reference in New Issue
Block a user