test: assert the repo escape hatch works at depth, not that it fails - #200
Merged
Merged
Conversation
t9007's fourth case expected `bit repo status` from a deep nested path to fail with "Not a git repository". That expectation was never satisfiable and contradicts what `bit repo` is for. `bit repo <command>` is documented as "bypass workspace implicit command translation and run regular bit commands" (print_repo_usage), and it is implemented as a plain dispatch — handle_repo hands the command straight to dispatch_command with no path pinning. A regular command locates its repository by walking up, exactly as git does: real git run from nested/a/b/c in the same fixture prints "On branch master" too. Making the escape hatch fail below the repository root would be a git-compatibility regression, not a feature. The string the test greps for is not reachable either: "Not a git repository" is raised only by push and submodule when validating a remote or submodule URL, never by status. So the case is rewritten to assert the property the file is actually about — the escape hatch bypasses translation at any depth, mirroring the preceding case at the workspace root. With this, the whole t9 range is green: t900 11/11, t901 8/8, t902 2/2. Fixes #196 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VDVUJHu38YtVAr6sKZtRDB
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 #196.
This is the spec call I flagged in #199 rather than guessing at. Having dug into it, the test's expectation is wrong and the behaviour is right — so this changes the test. Reasoning below in case you read it the other way.
The assertion
Why the behaviour is right
bit repois documented as a pass-through, not a path pin.print_repo_usagesays it exists to "bypass workspace implicit command translation and run regular bit commands", and that is how it is built:handle_repohands the command straight todispatch_commandwith no notion of pinning to the given directory. (run_workspace_repo_commanddoes take acwd, but it is the callbackhandle_workspaceuses to run a command against each workspace node — nothing to do withbit repo.)A regular command walks up, exactly as git does. Real git in the same fixture agrees:
Making the escape hatch fail below the repository root would be a git-compatibility regression. Someone inside a workspace who
cds into a subdirectory and reaches forbit repo statusto get plain behaviour would get an error instead.The expected string is not reachable.
"Not a git repository"is raised only bypushandsubmodulewhen validating a remote or submodule URL — never bystatus. Nothing in the dispatch path could have produced it, so this case cannot have passed since it was added in #139. Nothing undert/runs in CI, which is how it stayed that way.The change
The case now asserts the property the file is actually about — the escape hatch bypasses translation at any depth — mirroring the preceding case at the workspace root:
If you intended
bit repoto pin to the exact directory, say so and I will implement that instead — it would mean a change inhandle_repoplus a doc update, and I would want to check it against the git-compat suite first.Verification
t9007 goes 5/6 → 6/6, and with it the whole t9 range is green:
Measured with
GIT_CONFIG_*unset, for the reason given in #199.This unblocks wiring
t/into CIThree PRs in a row now — #192, #199 and this one — have merged with CI validating essentially nothing, because no job invokes the
test-subdirtask andselectskips everything for at/-only diff. That is also why t9014, t90010 and this assertion sat broken without anyone noticing.The blocker for fixing that was the red tests, and they are now all green. Happy to open a follow-up that adds a CI job for the
t/suite if you want it — worth deciding whether it covers the whole tree or justt9, since I have not auditedt0xxxhere.🤖 Generated with Claude Code
https://claude.ai/code/session_01VDVUJHu38YtVAr6sKZtRDB
Generated by Claude Code