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:
Cosimo Streppone 2021-01-13 09:42:33 +01:00 committed by Kaido Kert
parent f095bcc56b
commit 55709ffa1b
2 changed files with 12 additions and 6 deletions

View file

@ -364,11 +364,13 @@ class GitAuthHelper {
}
}
const pattern = regexpHelper.escape(configKey)
await this.git.submoduleForeach(
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
`sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`,
true
)
if (this.settings.submodules) {
const pattern = regexpHelper.escape(configKey)
await this.git.submoduleForeach(
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
`sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`,
true
)
}
}
}