Default branch is hard-coded to main and nothing changes it #189

closed cmc opened this on 2026-09-07 21:59 UTC · bug control

Discussion

cmc 2026-09-07 21:59 UTC

repo create inits with --initial-branch=main (internal/control/repo.go:204), the store's default_branch column defaults to main, and gitutil.SetHead and Store.UpdateDefaultBranch are reached only by repo import. A repository whose first push is master or trunk accepts the push and then HEAD names a branch that does not exist: git clone prints remote HEAD refers to nonexistent ref, unable to checkout and leaves an empty working tree, and every surface reads the stored main and asks git for a branch that is not there.

Wants repo settings default-branch <owner/name> <branch> (store column plus symbolic-ref), and a first push into an unborn HEAD moving HEAD to the branch that arrived. Parity row on the wiki.

Ref #185

closed by commit 3797906826 by cmc: control, hookd, web, wiki: the default branch can be set, and follows the first push

2026-09-08 02:35 UTC