Skip to content

test(git): cover the sparse-checkout false-positive class removed by #10537 - #10547

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/sparse-checkout-false-positive-test
Jul 25, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/sparse-checkout-false-positive-test

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Summary

Recovers a regression test written during the review of #10537 that was lost to a GitHub PR/ref desync: the branch ref advanced, but the PR object's head.sha stayed stale and no synchronize event fired, so the squash merge used the older sha.

The fix itself shipped in #10537. Only this test was missed. No source changes here.

What it covers

A [section "sub"]key = value line matched neither branch of the old anchored ^\[...\]$ regex, so the parser never left [core] and credited the next indented line to it — reporting sparse for a worktree git says is not.

[core]
[core "sub"]worktreeConfig = x
	sparseCheckout = true

Verified against a real git binary: git config --file <f> --get --type=bool core.sparseCheckout reports unset. The pre-#10537 parser returned true (bogus sparse badge); the shipped parser returns undefined.

This pins the opposite failure mode from the one #10537 set out to fix — loosening the header regex could have introduced false positives, and this proves it did not.

Verification

  • worktree-sparse-checkout.test.ts — 21/21 pass on merged main
  • Vector confirmed against real git 2.x, not just reasoned from the spec

The old anchored regex matched neither branch on a `[section "sub"]key = value`
line, so the parser never left `[core]` and credited the next indented line to
it — reporting sparse for a worktree git says is not. Fails on the pre-fix
parser (returns true where git reports unset).
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fc03cb0d-ab61-4798-9d5e-1b8acffa9f00

📥 Commits

Reviewing files that changed from the base of the PR and between baf2578 and fd2f804.

📒 Files selected for processing (1)
  • src/main/git/worktree-sparse-checkout.test.ts

📝 Walkthrough

Walkthrough

Adds a regression test for parseCoreSparseCheckoutFlag. The test covers a [core "sub"] subsection header with an inline assignment to another key, followed by an indented sparseCheckout = true line, and expects the parser to return undefined.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, behavior, and verification, but it omits several required template sections such as Screenshots, Testing, AI Review Report, Security Audit, and Notes. Add the missing template sections, including testing checklist results, AI review report, security audit, screenshots or no visual change, and notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the PR’s main change: adding a regression test for the sparse-checkout false-positive case.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brennanb2025
brennanb2025 merged commit 159057c into main Jul 25, 2026
2 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…stablyai#10547)

The old anchored regex matched neither branch on a `[section "sub"]key = value`
line, so the parser never left `[core]` and credited the next indented line to
it — reporting sparse for a worktree git says is not. Fails on the pre-fix
parser (returns true where git reports unset).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant