Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ignore git submodules when scanning for manifests#76

Merged
andrew merged 1 commit intomainfrom
ignore-git-submodules
Feb 5, 2026
Merged

Ignore git submodules when scanning for manifests#76
andrew merged 1 commit intomainfrom
ignore-git-submodules

Conversation

@andrew
Copy link
Contributor

@andrew andrew commented Feb 4, 2026

Fixes #72

Manifests and lockfiles found in git submodule directories are now properly ignored when scanning the working directory. This prevents dependencies from submodules being incorrectly reported as part of the main repository.

The implementation uses go-git's native Worktree.Submodules() API to detect submodule paths, which are then filtered out during filesystem walks in both the analyzer and where command.

Changes:

  • Added GetSubmodulePaths() method to Repository using go-git's submodule support
  • Updated DependenciesInWorkingDir() to skip submodule directories
  • Updated where command to skip submodule directories
  • Added comprehensive tests for submodule filtering

Fixes #72

Manifests and lockfiles found in git submodule directories are now properly ignored by default when scanning the working directory. This prevents dependencies from submodules being incorrectly reported as part of the main repository.

A new --include-submodules flag allows opting in to scanning submodules when needed.

The implementation uses go-git's native Worktree.Submodules() API to detect submodule paths, which are then filtered out during filesystem walks in both the analyzer and where command.

Changes:
- Added GetSubmodulePaths() method to Repository using go-git's submodule support
- Updated DependenciesInWorkingDir() to skip submodule directories by default
- Updated where command to skip submodule directories by default
- Added --include-submodules persistent flag to opt in to scanning submodules
- Updated diff command to respect the flag
- Added comprehensive tests for submodule filtering
- Documented the flag in README.md and docs/internals.md
@andrew andrew force-pushed the ignore-git-submodules branch from 0737973 to 813f4a7 Compare February 5, 2026 11:59
@andrew andrew merged commit a532bd3 into main Feb 5, 2026
4 checks passed
@andrew andrew deleted the ignore-git-submodules branch February 5, 2026 12:17
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.

Dependencies in git submodules and tests/fixtures

1 participant