Skip to content

fork-ci git-clean: allow the index.sparse checkout's sparse-checkout disable writes - #1281

Merged
scuttletoby merged 1 commit into
mainfrom
fix/git-clean-index-sparse
Nov 29, 2026
Merged

scuttletoby merged 1 commit into
mainfrom
fix/git-clean-index-sparse

Conversation

@scuttletoby

Copy link
Copy Markdown
Owner

Fixes #1259

What

git_clean.py check --require (ci/v37) refused index.sparse in .git/config.worktree. On git 2.43 (Ubuntu 24.04), actions/checkout's own git sparse-checkout disable writes that key on every checkout that has no sparse-checkout input. So every action that runs the check failed its first step after a normal checkout.

  • ALLOWED now has index.sparse with a boolean value (BOOL). Any other value is still refused ("not a value actions/checkout writes"). A comment next to the entry gives the reason.

  • I checked the other keys checkout writes this way with real git 2.43:

    • sparse-checkout disable writes core.sparseCheckout, core.sparseCheckoutCone and index.sparse.
    • sparse-checkout set --cone and set --no-cone write core.sparseCheckout and core.sparseCheckoutCone.
    • extensions.worktreeConfig is unset by checkout after disable and kept after set.

    All of these keys except index.sparse were already allowed as booleans, so nothing else is added.

  • git-clean/README.md lists the key. RELEASE-NOTES.md has an entry, with no upgrade step.

Tests (real git, no fixture)

  • test_checkouts_own_sparse_checkout_disable_passes: makes a repository the way actions/checkout does, runs git sparse-checkout disable, then unsets extensions.worktreeConfig as checkout does. problems() must be empty, and check --path . --require (the CLI) must exit 0. Fails on main with "config.worktree holds index.sparse, which actions/checkout never writes".
  • test_index_sparse_holds_a_boolean_only: a non-boolean index.sparse is still refused, by its value. Fails on main because main refuses the key itself, so the value is never checked.
  • test_checkouts_own_sparse_checkout_set_passes: covers the sparse-checkout input (set, cone and not cone). It already passes on main and is there as a guard.

Run locally: git_clean.test.py (63 OK), review_config.test.py, review_guide.test.py, fork-head-gate-workflow.test.py: all pass.

After merge

This needs a fork-ci release (a new ci/vN) before SkyRPG can move its pin from ci/v10. The orchestrator runs release-at-tip.sh.

🤖 Generated with Claude Code

…disable writes

actions/checkout runs `git sparse-checkout disable` whenever its
sparse-checkout input is empty, then unsets only extensions.worktreeConfig.
On git 2.43 that leaves core.sparseCheckout, core.sparseCheckoutCone and
index.sparse in .git/config.worktree, even in a new repository, and
`check --require` refused index.sparse, so every action's first step failed
after such a checkout.

Allow index.sparse with a boolean value; any other value is still refused.
The other keys checkout writes this way (core.sparseCheckout,
core.sparseCheckoutCone, extensions.worktreeConfig) were already allowed.
Tests run the real git: `sparse-checkout disable` and `set` (cone and not)
on a checkout-shaped repository pass, and a non-boolean index.sparse fails.

Fixes #1259

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: Claude (code lens) · read at: b50ed46

blocker: none
major: none
minor: index.sparse accepts any boolean, true included, but checkout only ever writes false. true turns on the sparse index. It runs no command, and since checkout unsets extensions.worktreeConfig, config.worktree is not even read afterwards. It also matches how core.sparsecheckout* are already handled, so this is fine as it is. Tighten it to (?i:false|no|off|0), as core.bare does, only if you want an exact match.

What I checked

  • The new ALLOWED entry is matched with fullmatch on the lower-case key that git config --list prints (index.sparse). It covers both config and config.worktree. A bare [index] sparse reads as true (in entries()) and passes. Any other value still goes to the value-refusal branch, which test_index_sparse_holds_a_boolean_only pins by its message.
  • The tests use the runner's real git and copy checkout's steps (disable and then unsetting extensions.worktreeConfig, plus set --cone/--no-cone). The disable test and the non-boolean test fail on main, as the PR body says, and they guard the CLI path too (check --require exits 0).
  • The subtest loop rebuilds the workspace for each cone mode, so no state leaks between iterations.
  • The README and release-notes entries match the change. No upgrade step is needed.

State: check only reads. Running it again gives the same answer. If it stops half-way, nothing has been written. A workspace left by an older checkout or an older git without index.sparse passes as before. A reused self-hosted workspace whose index.sparse holds a non-boolean value is still refused. An empty or absent config path takes the same route as on main.

🤖 Generated with Claude Code

@scuttletoby scuttletoby added the fork:merge-ready Merge conveyor: lenses done, merge when green (PRs) label Nov 29, 2026
@scuttletoby
scuttletoby merged commit 9cb2b1c into main Nov 29, 2026
27 checks passed
@scuttletoby
scuttletoby deleted the fix/git-clean-index-sparse branch November 29, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork:merge-ready Merge conveyor: lenses done, merge when green (PRs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fork-ci git-clean: refuses index.sparse, which actions/checkout's own 'sparse-checkout disable' writes (git 2.43)

1 participant