Skip to content

Fix generate-config --from-setup to include sparse checkout paths#46

Open
Copilot wants to merge 4 commits intomainfrom
copilot/fix-generate-config-sparse-checkout
Open

Fix generate-config --from-setup to include sparse checkout paths#46
Copilot wants to merge 4 commits intomainfrom
copilot/fix-generate-config-sparse-checkout

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

generate-config --from-setup reads .gitmodules to reconstruct a submod.toml, but sparse checkout patterns live in each submodule's .git/info/sparse-checkout file — not .gitmodules — so they were silently dropped from the generated config.

Changes

  • src/git_manager.rs: After reading entries from .gitmodules, iterate over each submodule path and call git_ops.get_sparse_patterns(path) to read the sparse-checkout file. Non-empty patterns are written back onto the entry before building the config.

  • src/config.rs: Added SubmoduleEntries::set_sparse_paths_for(&mut self, name, paths) — updates sparse_paths on the entry in-place and keeps the parallel sparse_checkouts map in sync, avoiding a full clone-modify-update cycle.

  • tests/command_contract_tests.rs: Added test_generate_config_from_setup_includes_sparse_paths — adds a submodule with --sparse-paths src,docs, runs generate-config --from-setup, and asserts the generated TOML reflects those paths.

# Before: sparse_paths silently absent
[sparse-lib]
path = "lib/sparse"
url = "file:///tmp/repo"

# After: sparse_paths correctly captured
[sparse-lib]
path = "lib/sparse"
url = "file:///tmp/repo"
sparse_paths = ["src", "docs"]

Copilot AI and others added 2 commits April 4, 2026 04:00
Copilot AI changed the title [WIP] Fix sparse checkout configurations in generate-config Fix generate-config --from-setup to include sparse checkout paths Apr 4, 2026
Copilot AI requested a review from bashandbone April 4, 2026 04:07
@bashandbone bashandbone marked this pull request as ready for review April 4, 2026 04:08
Copilot AI review requested due to automatic review settings April 4, 2026 04:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes generate-config --from-setup so the generated submod.toml includes each submodule’s sparse checkout paths by reading them from the submodule repo’s sparse-checkout file (since this data is not stored in .gitmodules).

Changes:

  • Populate sparse_paths during generate-config --from-setup by calling git_ops.get_sparse_patterns() per submodule.
  • Add SubmoduleEntries::set_sparse_paths_for() to update sparse_paths and keep sparse_checkouts synchronized.
  • Add a contract test asserting generated config output includes sparse_paths.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/git_manager.rs Augments --from-setup config generation by pulling sparse patterns from submodule sparse-checkout configuration.
src/config.rs Adds an in-place helper to set sparse_paths while attempting to keep the parallel sparse map in sync.
tests/command_contract_tests.rs Adds a regression test to ensure sparse paths appear in the generated TOML.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/config.rs 64.28% 5 Missing ⚠️
src/git_manager.rs 92.30% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/git_manager.rs 88.47% <92.30%> (+0.03%) ⬆️
src/config.rs 80.81% <64.28%> (-0.17%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

submod generate-config --from-setup doesn't include sparse checkout configurations

3 participants