fix: sparse-checkout not disabled on subsequent checkout

If actions/checkout is invoked once with 'sparse-checkout' and cone mode
disabled, core.sparseCheckout remains enabled for all subsequent
invocations of actions/checkout.
This commit is contained in:
Antoine Cotten 2025-08-26 21:19:43 +02:00
parent ff7abcd0c3
commit 21358322e0
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View file

@ -178,7 +178,9 @@ class GitCommandManager {
async disableSparseCheckout(): Promise<void> {
await this.execGit(['sparse-checkout', 'disable'])
// Disabling 'sparse-checkout` leaves behind an undesirable side-effect in config (even in a pristine environment).
// Ensures that a previously enabled 'sparse-checkout' (e.g. via sparseCheckoutNonConeMode) is also disabled in the config.
await this.execGit(['config', 'core.sparseCheckout', 'false'])
// Disabling 'sparse-checkout' leaves behind an undesirable side-effect in config (even in a pristine environment).
await this.tryConfigUnset('extensions.worktreeConfig', false)
}