Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HEAD is not set to alternative default brach when using a template #13912

Closed
2 of 6 tasks
kb173 opened this issue Dec 9, 2020 · 0 comments · Fixed by #13948
Closed
2 of 6 tasks

HEAD is not set to alternative default brach when using a template #13912

kb173 opened this issue Dec 9, 2020 · 0 comments · Fixed by #13948
Labels

Comments

@kb173
Copy link

kb173 commented Dec 9, 2020

  • Gitea version (or commit ref): 1.14.0+dev-290-gb1cf7f4df built with GNU Make 4.3, go1.15.5 : bindata, timetzdata, sqlite, sqlite_unlock_notify
  • Git version: 2.26.2
  • Operating system: 18.04.5 LTS

I am running Gitea using Docker, using the (slightly modified) docker-compose.yaml.

Description

I created a template repository whose default branch is named "main" instead of "master". When I create a new repository from this template, ticking "Git Content (Default Branch)", the HEAD is set incorrectly on the server:

When cloning, I get the notice "warning: remote HEAD refers to nonexistent ref, unable to checkout.". I get placed in the non-existent master branch and I need to manually checkout the main branch in order to access the files in the repository.

Upon inspection of the HEAD on the remote (in the Gitea repository folder on the server, via SSH), I see that the HEAD is set wrongly. It is ref: refs/heads/master, but it should be ref: refs/heads/main. Manually editing this solves the issue for this repository.

Note that this is not the case in the template repository, only in the one instanced from this template.

I reproduced the issue in https://gitea.com/kb173/main-bug, which is instanced from the template https://gitea.com/kb173/template-default-main. As you can see, the web-UI correctly shows "main" as the only branch, but when cloning, the aforementioned warning occurs.

Seems to be related to #7601. While that is indeed fixed when creating a new repository from scratch, the problem seems to persist with repositories from templates.

zeripath added a commit to zeripath/gitea that referenced this issue Dec 11, 2020
…ation

Fix go-gitea#13912

Signed-off-by: Andrew Thornton <art27@cantab.net>
6543 pushed a commit that referenced this issue Dec 11, 2020
…ation (#13948)

Fix #13912

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants