From 38edafb45c16dc5a3765999ae968cd324ddc9dfb Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 21 Sep 2026 10:53:45 +0000 Subject: [PATCH] test: assert the repo escape hatch works at depth, not that it fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ` 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 Claude-Session: https://claude.ai/code/session_01VDVUJHu38YtVAr6sKZtRDB --- t/t9007-workspace-nested-translation.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/t/t9007-workspace-nested-translation.sh b/t/t9007-workspace-nested-translation.sh index 3538d49f..c68c4ff4 100755 --- a/t/t9007-workspace-nested-translation.sh +++ b/t/t9007-workspace-nested-translation.sh @@ -33,13 +33,14 @@ test_expect_success 'repo status bypasses workspace translation at workspace roo ! grep "workspace root:" nested-repo-status.out ' -test_expect_success 'repo status from deep nested path fails as plain repo command' ' - if $BIT -C nested/a/b/c repo status > nested-repo-nested.out 2>&1; then - false - else - true - fi && - grep "Not a git repository" nested-repo-nested.out +# The escape hatch has to work at any depth, not only at the workspace root: +# `bit repo ` means "skip the implicit translation and run the regular +# command", and a regular command finds its repository by walking up, exactly +# as git does from a subdirectory. +test_expect_success 'repo status from deep nested path also bypasses workspace translation' ' + $BIT -C nested/a/b/c repo status > nested-repo-nested.out 2>&1 && + grep "On branch" nested-repo-nested.out && + ! grep "workspace root:" nested-repo-nested.out ' test_expect_success 'implicit commit from workspace root performs workspace commit' '