Repository navigation
Stop git discovery at the mirror directory [patch] - #108
Merged
Merged
Conversation
A mirror directory that is no longer a repository (a partial delete, the reaper racing MarkUsed) did not fail: git walked up to the first enclosing repository and answered from it, serving another repository's branches. Every run with a working directory now sets GIT_CEILING_DIRECTORIES to that directory's parent, so the directory's own repository is still found but discovery never leaves it. Fixes #104 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW3f2Szc4ZLoCTbPhuX
|
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.



Fixes #104
What changed
GitRunner.BuildEnvironmentstripped inheritedGIT_*variables but did not stop git's upward repository discovery. A mirror directory can stop being a repository, for example after a partial delete or the reaper/MarkUsedrace (#58). When that happened, git walked up to the first enclosing repository and answered from it. That could be a checkout holding the mirror root, or an outer bare mirror. The result:/branchesand 409 bodies served repository Y's branches to a caller admitted only for repository X.Every invocation with a
WorkingDirectorynow setsGIT_CEILING_DIRECTORIESto that directory's parent:not a git repositoryinstead of reading a neighbour.GIT_DIRbecause clone (run from the mirror's parent) and the staginggit configalso go through this path. The ceiling is safe for all of them.GIT_CEILING_DIRECTORIESis still dropped like any otherGIT_*variable.Tests
BuildEnvironment_WithAWorkingDirectory_StopsDiscoveryAtItandBuildEnvironment_WithoutAWorkingDirectory_SetsNoCeiling(unit).RefResolver_ABrokenMirrorInsideAnotherRepository_ReadsNothing(real git): a mirror directory holding only.last-usedinside the fixture's work tree.ListAsyncreturns null. Onmainit returned the work tree's branches.GitRunner.csreverted. Full suite: 283/283 passed.Generated by Claude Code