Skip to content

Commit a0847da

Browse files
committed
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.
1 parent cbb7224 commit a0847da

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

dist/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,8 @@ class GitCommandManager {
588588
disableSparseCheckout() {
589589
return __awaiter(this, void 0, void 0, function* () {
590590
yield this.execGit(['sparse-checkout', 'disable']);
591+
// Ensures that a previously enabled 'sparse-checkout' (e.g. via sparseCheckoutNonConeMode) is also disabled in the config.
592+
yield this.execGit(['config', 'core.sparseCheckout', 'false']);
591593
// Disabling 'sparse-checkout` leaves behind an undesirable side-effect in config (even in a pristine environment).
592594
yield this.tryConfigUnset('extensions.worktreeConfig', false);
593595
});

src/git-command-manager.ts

+2
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ class GitCommandManager {
178178

179179
async disableSparseCheckout(): Promise<void> {
180180
await this.execGit(['sparse-checkout', 'disable'])
181+
// Ensures that a previously enabled 'sparse-checkout' (e.g. via sparseCheckoutNonConeMode) is also disabled in the config.
182+
yield this.execGit(['config', 'core.sparseCheckout', 'false']);
181183
// Disabling 'sparse-checkout` leaves behind an undesirable side-effect in config (even in a pristine environment).
182184
await this.tryConfigUnset('extensions.worktreeConfig', false)
183185
}

0 commit comments

Comments
 (0)