Closed
Description
Gitea version: 1.15.9
Jan 13 05:25:12 my-host gitea[10979]: 2022/01/13 05:25:12 Started GET /testuser/pandas/branches for 127.0.0.1:48032
Jan 13 05:25:12 my-host gitea[10979]: 2022/01/13 05:25:12 ...s/web/repo/branch.go:168:loadBranches() [E] loadBranches: get default branch: branch does not exist [name: master]
Jan 13 05:25:12 my-host gitea[10979]: 2022/01/13 05:25:12 ...s/web/repo/branch.go:169:loadBranches() [E] GetDefaultBranch: branch does not exist [name: master]
Jan 13 05:25:12 my-host gitea[10979]: 2022/01/13 05:25:12 Completed GET /testuser/pandas/branches 500 Internal Server Error in 110.488967ms
Jan 13 05:25:12 my-host gitea[10979]: 2022/01/13 05:25:12 Started GET /assets/img/500.png for 127.0.0.1:48034
Activity
lunny commentedon Jan 14, 2022
Is there any branch in this repository?
ghost commentedon Jan 14, 2022
Yes, but the original repository does not contain a 'master' branch ( e.g., https://github.com/pandas-dev/pandas )
zeripath commentedon Jan 14, 2022
this is I presume related to an adopted repository?
wxiaoguang commentedon Jan 15, 2022
@tim-kong Can you help to confirm the problem? How the
/testuser/pandas
comes, was it adopted (imported from Gitea repository directory directly) before?ghost commentedon Jan 15, 2022
OK. Login as testuser , and just mirror the Pandas repository ('https://github.com/pandas-dev/pandas') using Gitea web page (http://example.com/repo/migrate). Don't need to do anything. And when accessing http://example.com/testuser/pandas/branches you well see 500 error.
Thanks.
somera commentedon Jan 15, 2022
Works for me in Gitea 1.15.10. It need some seconds, but it works.
My URL: http://nuc-mini-celeron:3000/pandas-dev/pandas/branches
Powered by Gitea Version: 1.15.10 Seite: 4904ms Template: 26ms
zeripath commentedon Jan 15, 2022
I can't reproduce this on main/1.16.0.
(I had this right I can't reproduce this on main)
zeripath commentedon Jan 15, 2022
Can anyone reproduce this on 1.16?
wxiaoguang commentedon Jan 15, 2022
I can trigger the bug manually in 1.16:
repository
.default_branch
to a non-existing one/owner/repo/branches
I can imagine a real case: if a user changes a git repository with a different default branch name (eg: changes the git repository on the server), they would also trigger this bug. I am not sure whether force-push would also trigger such bug.
Maybe the better behavior is getting rid of the 500 page (internal error should be something serious, but not this case)
ghost commentedon Jan 15, 2022
I update my gitea version to 1.15.10, and cannot trigger the bug.
wxiaoguang commentedon Jan 15, 2022
Actually, 1.15.10 only contains some small fixes, and should not be related to this bug (https://github.com/go-gitea/gitea/releases/tag/v1.15.10) . I suspect you did something or Gitea did something, then the
default_branch
gets a correct value.zeripath commentedon Jan 15, 2022
Weirdly I wasn't able to do this on pandas.
AHA The /owner/repo/branches bit was the thing I was missing.
ghost commentedon Jan 15, 2022
pandas-dev/pandas@50ac498
It is probably the root cause.... Pandas has recently replace 'master' with 'main', just several days ago.
Handle missing default branch better in owner/repo/branches page
zeripath commentedon Jan 15, 2022
I've put a PR in to handle this but we might not necessarily backport it.
[-]500 error when default banch doesn't exist[/-][+]500 error when default banch doesn't exist on owner/repo/branches page[/+]Handle missing default branch better in owner/repo/branches page (#18290
Handle missing default branch better in owner/repo/branches page (go-…