Repository navigation
Report only a working-tree root as cloned, not a directory inside another repository [patch] - #204
matt-edmondson wants to merge 1 commit into
Conversation
…ther repository [patch] IsClonedAsync asked `rev-parse --is-inside-work-tree`, which walks up the directory tree, so an empty directory beneath another repository's working tree reported as cloned. "Clone if not cloned" then skipped the clone and later verbs ran against the outer repository. It now asks `--is-inside-work-tree --show-cdup` and requires an empty way up, so only the root counts. Submodules, linked worktrees and --separate-git-dir checkouts are still roots; IGitClient.IsRepositoryAsync keeps its "inside a working tree" contract. Fixes #185 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019BwRbgKQMY5pZraxHBjxqM
|
|
Cross-Platform Tests / Test on macos-latest was cancelled at the job's 15-minute timeout. It stalled inside the
No fix exists yet for the intermittent macOS stall, so I'm re-running the failed job once. If it stalls again, I'll treat it as real and investigate it on this PR. Generated by Claude Code |
|
The re-run of Cross-Platform Tests / Test on macos-latest also hit the 15-minute timeout inside
I don't have a fix to push from here, and I've used my one re-run. Proposed next step (not pushed, since it widens this PR into CI config): add a hang dump to that workflow's Test step so the next stall names the test: run: dotnet test --no-build --configuration Release -- --hangdump --hangdump-timeout 5m(Microsoft Testing Platform's hang-dump extension may need Generated by Claude Code |



Fixes #185
Summary
GitRepository.IsClonedAsync()askedgit rev-parse --is-inside-work-tree. That check walks up the directory tree, so it returnedtruefor an empty directory beneath another repository's working tree. As a result, "clone if not cloned" skipped the clone, andStatus(),Commit()and the other verbs then ran silently against the outer repository.GitProbes.IsWorkTreeRootAsyncrunsrev-parse --is-inside-work-tree --show-cdup. A path counts as cloned only when it is inside a working tree and--show-cdupis empty, meaning the path is the root.--show-cduplooks at the working tree, not the git directory. Submodules, linked worktrees and--separate-git-dircheckouts, whose.gitis a file, therefore still count as roots, which covers the cases Init() reports AlreadyExisted = false when re-initializing a submodule, worktree or --separate-git-dir repository, hiding an ignored --initial-branch #138 had to handle. A bare repository has no working tree and still counts as not cloned, as before.IGitClient.IsRepositoryAsync/OpenAsynckeep the "inside a working tree" semantics through the unchangedGitProbes.IsWorkTreeAsync.Tests
false, and the outer repository reportstrue.--separate-git-dircheckout and a linked worktree reporttrue.true, and the superproject directory holding it reportsfalse.true\n../output reportsfalse.🤖 Generated with Claude Code
https://claude.ai/code/session_019BwRbgKQMY5pZraxHBjxqM
Generated by Claude Code