Skip to content

t9014 and t90010 fail wherever git's default branch is not main #191

Description

@mizchi

Summary

fixtures/workspace_flow/bootstrap.sh creates its repositories with a bare git init, so the branch is whatever the host git defaults to. Two tests built on that fixture then hardcode main, and fail on any machine where init.defaultBranch is unset and git still defaults to master (git 2.43 here).

  • t/t9014-workspace-hub-flow.sh — 2 of 2 fail
  • t/t90010-workspace-git-compat.sh — 2 of 7 fail

Setting git config --global init.defaultBranch main makes both pass, which pins the cause.

Repro

git config --global --unset init.defaultBranch   # or start from a clean machine
bash t/t9014-workspace-hub-flow.sh
not ok 1 - setup: bootstrap workspace, init hub, and create PR
cat: ws-flow-pr-id.txt: No such file or directory
not ok 2 - workspace flow --pr records workflow result with fingerprint
# passed: 0   failed: 2

Walking the setup by hand shows where it breaks:

error: pathspec 'main' did not match any file(s) known to git
hub failed: Target branch not found: refs/heads/main

The fixture produced master:

$ fixtures/workspace_flow/bootstrap.sh ws && git -C ws symbolic-ref HEAD
refs/heads/master

Cause

fixtures/workspace_flow/bootstrap.sh:23

cd "$repo_dir"
git init -q                  # no -b, no init.defaultBranch

while t9014 does git checkout main and bit hub pr create --base refs/heads/main, and t90010 does git push -u origin main.

Suggested fix

Pin the branch in the fixture — git init -q -b main (or git symbolic-ref HEAD refs/heads/main right after, for older git) — so the tests do not depend on the host's git configuration. The seven other tests on this fixture do not name a branch and are unaffected either way.

Note on visibility

These tests are not run by CI: no job invokes the test-subdir task, so nothing under t/ runs there. They are only reached by pkf run test-subdir or bash t/run-tests.sh locally, which is why the breakage has gone unnoticed.

Separately, that task's filter is a substring match, so t900 alone also skips t9011–t9021 — including t9020-http-push-negotiation.sh. #190 adds a t902 pass for t9020 and the new shallow test; t9011–t9018 are still not covered by any filter.

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