mirror of
https://code.forgejo.org/actions/checkout.git
synced 2024-11-23 09:54:51 +01:00
GH#354 Disabled auth submodules config when related setting is false
This should help with https://github.com/actions/checkout/issues/354. The problem is that I have no idea whether such auth submodules configuration is required even when settings.submodules is false.
This commit is contained in:
parent
5a4ac9002d
commit
66145e68c7
2 changed files with 11 additions and 5 deletions
|
@ -450,6 +450,7 @@ describe('git-auth-helper tests', () => {
|
||||||
)
|
)
|
||||||
settings.persistCredentials = false
|
settings.persistCredentials = false
|
||||||
settings.sshKey = ''
|
settings.sshKey = ''
|
||||||
|
settings.submodules = true
|
||||||
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
||||||
await authHelper.configureAuth()
|
await authHelper.configureAuth()
|
||||||
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
|
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
|
||||||
|
@ -483,6 +484,7 @@ describe('git-auth-helper tests', () => {
|
||||||
configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsFalseAndSshKeySet
|
configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsFalseAndSshKeySet
|
||||||
)
|
)
|
||||||
settings.persistCredentials = false
|
settings.persistCredentials = false
|
||||||
|
settings.submodules = true
|
||||||
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
||||||
await authHelper.configureAuth()
|
await authHelper.configureAuth()
|
||||||
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
|
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
|
||||||
|
@ -509,6 +511,7 @@ describe('git-auth-helper tests', () => {
|
||||||
configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsTrueAndSshKeyNotSet
|
configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsTrueAndSshKeyNotSet
|
||||||
)
|
)
|
||||||
settings.sshKey = ''
|
settings.sshKey = ''
|
||||||
|
settings.submodules = true
|
||||||
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
||||||
await authHelper.configureAuth()
|
await authHelper.configureAuth()
|
||||||
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
|
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
|
||||||
|
@ -543,6 +546,7 @@ describe('git-auth-helper tests', () => {
|
||||||
await setup(
|
await setup(
|
||||||
configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsTrueAndSshKeySet
|
configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsTrueAndSshKeySet
|
||||||
)
|
)
|
||||||
|
settings.submodules = true
|
||||||
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
||||||
await authHelper.configureAuth()
|
await authHelper.configureAuth()
|
||||||
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
|
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
|
||||||
|
|
|
@ -341,10 +341,12 @@ class GitAuthHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const pattern = regexpHelper.escape(configKey)
|
if (this.settings.submodules) {
|
||||||
await this.git.submoduleForeach(
|
const pattern = regexpHelper.escape(configKey)
|
||||||
`git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :`,
|
await this.git.submoduleForeach(
|
||||||
true
|
`git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :`,
|
||||||
)
|
true
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue