Skip to content

Fix multi-repo support#69

Open
lfrancke wants to merge 1 commit intoJordanCoin:mainfrom
lfrancke:fix/multi-repo
Open

Fix multi-repo support#69
lfrancke wants to merge 1 commit intoJordanCoin:mainfrom
lfrancke:fix/multi-repo

Conversation

@lfrancke
Copy link
Copy Markdown

@lfrancke lfrancke commented Apr 6, 2026

What does this PR do?

The tool would bail out too early so far. It would detect that there is no git directory and then bail instead of checking for subdirectories with git directories.

I also had to skip the git check-ignore check when there is no .git directory.

I tested it locally and it seems to work fine for me!
I tested it in a normal git repo, in a parent directory with multiple sub-repos and in a directory with no repo at all.

Type of change

  • Bug fix
  • New feature
  • New language support
  • Documentation
  • Other (describe below)

Checklist

  • I've tested this locally with go build && ./codemap .
  • I've read CONTRIBUTING.md (for new language support)
  • I've updated documentation if needed

The tool would bail out too early so far. It would detect that there is no git directory and then bail instead of checking for subdirectories with git directories
// hookSessionStart shows project structure, starts daemon, and shows hub warnings
func hookSessionStart(root string) error {
// Guard: require git repo
// Handle meta-repo: parent directory containing child git repos.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This changes no code: It only swaps the multiRepo check with the "git guard"

for _, line := range strings.Split(strings.TrimSpace(string(out)), "\n") {
if line != "" {
ignored[line] = true
if _, err := os.Stat(filepath.Join(root, ".git")); err == nil {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This just skips git check-ignore if there is no .git directory

Copy link
Copy Markdown
Owner

Thanks for taking this on, and for spelling out the cases you tested in the PR description (normal git repo, parent dir with multiple sub-repos, and directory with no repo). The direction looks right to me: moving child-repo detection ahead of the top-level git guard is what unlocks the non-git multi-repo parent case.

The one case I think is still missing is: a non-git parent with multiple child repos where the parent .gitignore excludes one of those child repo directories. In that setup, this branch will still include the ignored child, because git check-ignore is skipped entirely when the parent has no .git.

Since findChildRepos is documented as honoring the parent ignore list, could you preserve that behavior in the new path and add a regression test for it? I think that would get this over the line.

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.

2 participants