Skip to content

fix: add opt-in initialized Git submodule indexing - #75

Open
yescine wants to merge 4 commits into
NanoNets:mainfrom
yescine:fix/issue-74
Open

fix: add opt-in initialized Git submodule indexing#75
yescine wants to merge 4 commits into
NanoNets:mainfrom
yescine:fix/issue-74

Conversation

@yescine

@yescine yescine commented Aug 10, 2026

Copy link
Copy Markdown

Summary

  • preserve the existing graft build behavior: Git submodules remain excluded by default
  • add --follow-submodules and --no-follow-submodules
  • persist an explicit choice in the repo-local, Git-ignored .graft/config.json
  • make later no-flag builds, checks, hooks, fingerprints, CLI queries, and MCP automatic refreshes use that saved choice
  • recursively enumerate tracked and visible untracked files from initialized submodules only when enabled, including nested submodules
  • preserve each child repository's ignore rules, prefixed paths, size limits, and Graft skip/include behavior
  • propagate explicit choices into independently built workspace children without overwriting their other build settings

CLI contract

graft build                        # existing behavior: exclude submodules
graft build --follow-submodules    # include initialized submodules and persist true
graft build --no-follow-submodules # exclude submodules and persist false

A later graft build without either flag retains the saved choice. MCP queries do not need to pass a flag: their freshness probe and structural rebuild read the same local config.

Implementation

The default path still runs the original non-recursive git ls-files --cached --others --exclude-standard -z command and original filtering loop.

When following is enabled, the walker identifies mode-160000 gitlinks from NUL-delimited staged output and recursively runs a child-local visibility query. This is necessary because Git's --recurse-submodules mode cannot be combined with --others, so it cannot include visible untracked child files on its own.

Only initialized gitlinks are followed. Deinitialized submodules remain absent, broken child Git metadata falls back locally, and nested children retain their own Git ignore semantics.

Validation

  • tsc -p tsconfig.json
  • tsc -p viewer/tsconfig.json
  • node scripts/build-viewer.mjs
  • node scripts/run-tests.mjs — 588 tests: 584 passed, 4 platform skips
  • end-to-end regression coverage for default-off behavior, explicit enable/disable persistence, no-flag rebuilds, MCP refresh after a child edit, workspace propagation, nested/deinitialized submodules, child ignore isolation, paths with spaces, skip overrides, and fingerprint add/change/remove detection

Closes #74

@yescine
yescine marked this pull request as ready for review August 11, 2026 08:27
@yescine yescine changed the title fix: index initialized Git submodules fix: add opt-in initialized Git submodule indexing Aug 11, 2026
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.

Initialized Git submodules are not indexed from a superproject

1 participant