Skip to content

t9004-workspace-routing: bit branch output is grepped for main on a master repo #194

Description

@mizchi

Corrected. The original version of this issue claimed two failures, the interesting one being that implicit bit status is not translated to workspace status. That part was wrong — it was an artifact of the environment I triaged in, and is retracted below. One genuine failure remains, which is what this issue now tracks.

Summary

t/t9004-workspace-routing.sh fails 1 of 8 where init.defaultBranch is unset and git still defaults to master.

not ok 6 - non-workspace command still dispatches normally in workspace directory
# passed: 7   failed: 1

The failing assertion

	(cd repo &&
	 $BIT branch >../branch.out 2>&1) &&
	grep "main" branch.out

The test creates its repository with a bare git init, so the branch is master and grepping for main fails.

Suggested fix

Pin the branch where the test creates the repository — git init -b main, or git symbolic-ref HEAD refs/heads/main right after git init for git older than 2.28.

Same class as #191 (fixed in #192 for fixtures/workspace_flow/bootstrap.sh), #193 and #195.

Retraction: the implicit-translation claim

I originally reported that test 4 fails because bit status inside a workspace returns plain git status instead of the workspace form. It does not.

The container I triaged in exports git config through the environment — GIT_CONFIG_COUNT, GIT_CONFIG_KEY_0..2, GIT_CONFIG_VALUE_0..2, holding credential.interactive and two url.*.insteadOf entries for its proxy. should_delegate_to_real_git (modules/bit/cmd/bit/main.mbt:1044) treats any such injection as a reason to hand the command to the real git binary, and it runs before workspace_translate_implicit_command. So bit status never reached the translation. That is the documented intent of the check, not a defect.

With those variables unset, test 4 passes:

$ env -u GIT_CONFIG_COUNT -u GIT_CONFIG_KEY_0 ... bash t/t9004-workspace-routing.sh
not ok 6 - non-workspace command still dispatches normally in workspace directory
# passed: 7   failed: 1

#197 and #198 were entirely this artifact and are closed. #196 is corrected the same way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions