Skip to content

Commit 4c58a29

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 ff7abcd commit 4c58a29

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

dist/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,9 @@ class GitCommandManager {
588588
disableSparseCheckout() {
589589
return __awaiter(this, void 0, void 0, function* () {
590590
yield this.execGit(['sparse-checkout', 'disable']);
591-
// Disabling 'sparse-checkout` leaves behind an undesirable side-effect in config (even in a pristine environment).
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']);
593+
// Disabling 'sparse-checkout' leaves behind an undesirable side-effect in config (even in a pristine environment).
592594
yield this.tryConfigUnset('extensions.worktreeConfig', false);
593595
});
594596
}
@@ -38231,4 +38233,4 @@ module.exports = parseParams
3823138233
/******/ module.exports = __webpack_exports__;
3823238234
/******/
3823338235
/******/ })()
38234-
;
38236+
;

src/git-command-manager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ class GitCommandManager {
178178

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

0 commit comments

Comments
 (0)