fix(nested-repos): do not process repos nested inside a working tree#34
Merged
Conversation
Replaced the find-based .git directory scan with a recursive shell function that stops descending into a directory as soon as it finds a .git entry. This prevents the script from processing git repos that tools (e.g. parsimony) place inside another repo's working tree. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
richwklein
marked this pull request as ready for review
June 3, 2026 13:37
richwklein
pushed a commit
that referenced
this pull request
Jun 3, 2026
🤖 I have created a release *beep* *boop* --- ## [2.2.2](v2.2.1...v2.2.2) (2026-06-03) ### Bug Fixes * **nested-repos:** do not process repos nested inside a working tree ([#34](#34)) ([f8f7727](f8f7727)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-bot-richwklein[bot] <286966360+release-bot-richwklein[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When scanning a directory for git repositories, the script previously used
findto locate all.gitdirectories recursively. This caused it to descend into a repo's working tree and process any nested git repos it found there — including repos created by tools like parsimony that store git data inside another repo's working directory.Linked issue
Closes #
Type of change
Details
Replaced the
find -name ".git"scan with a recursive shell functionfind_git_repo_rootsthat walks subdirectories and yields a directory as a repo root the moment it finds a.gitentry, without recursing further into it. This means once the outer repo boundary is reached, no inner repos in its working tree are ever visited.The fix handles both
.gitdirectories (regular clones) and.gitfiles (linked worktrees) via[ -e "$subdir/.git" ].Release / deploy impact
no-deployValidation
Reviewer notes
The previous
find-based approach also had an intermediate fix (-not -path '*/.git/*') that filtered out.gitdirs nested inside another.git/directory. The recursive function makes that filter unnecessary — it never descends into.git/internals to begin with, and stops at working-tree boundaries too.