mirror of
https://github.com/go-gitea/gitea
synced 2025-01-18 19:27:43 +01:00
82728a7cec
Fix #21994. And fix #19470. While generating new repo from a template, it does something like "commit to git repo, re-fetch repo model from DB, and update default branch if it's empty".19d5b2f922/modules/repository/generate.go (L241-L253)
Unfortunately, when load repo from DB, the default branch will be set to `setting.Repository.DefaultBranch` if it's empty:19d5b2f922/models/repo/repo.go (L228-L233)
I believe it's a very old temporary patch but has been kept for many years, see: [2d2d85bb](https://github.com/go-gitea/gitea/commit/2d2d85bb#diff-1851799b06733db4df3ec74385c1e8850ee5aedee70b8b55366910d22725eea8) I know it's a risk to delete it, may lead to potential behavioral changes, but we cannot keep the outdated `FIXME` forever. On the other hand, an empty `DefaultBranch` does make sense: an empty repo doesn't have one conceptually (actually, Gitea will still set it to `setting.Repository.DefaultBranch` to make it safer).