-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
When generating repo from template, default_branch returns as blank string #19082
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
Comments
gitea/routers/api/v1/repo/repo.go Line 425 in 60fbaa9
repo object does not have that value and is created by gitea/modules/repository/generate.go Lines 244 to 257 in 60fbaa9
|
@ADawesomeguy I think it would make perfect sense to include the default_branch... Maybe even an option to define default_branch? 👼 |
I just had the generated repo define its default branch using the template repo's default branch, so hopefully that should work @truesteps. |
@ADawesomeguy I have an app where I use the api to generate new repos from templates, I allow the user to select a default branch of the generated repo, because it defaults to template default branch, I need to create new branch, change it to default, remove master basically :). It's a workable workaround It just feels like too many extra steps where it could fail for a basic operation. Thanks for the tip tho! |
@truesteps wait sorry could you explain that again? I'm a bit confused as to what you want but I'd be happy to give implementing the ideal situation a shot even though I'm a bit lacking in experience. |
Basically I would love to be able to pass a default_branch argument to the generate api, so the generated repo has a specific default branch, if left empty, defaults to default branch in template as the current behaviour dictates. @ADawesomeguy |
Awesome, I'll see if I can add that to my PR. |
@ADawesomeguy thanks dude :) 👍 |
) * Set the default branch for repositories generated from templates * Allows default branch to be set through the API for repos generated from templates * Update swagger API template * Only set default branch to the one from the template if not specified * Use specified default branch if it exists while generating git commits Fix #19082 Co-authored-by: John Olheiser <[email protected]> Co-authored-by: zeripath <[email protected]>
…gitea#19136) * Set the default branch for repositories generated from templates * Allows default branch to be set through the API for repos generated from templates * Update swagger API template * Only set default branch to the one from the template if not specified * Use specified default branch if it exists while generating git commits Fix go-gitea#19082 Co-authored-by: John Olheiser <[email protected]> Co-authored-by: zeripath <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Gitea Version
1.16.3
Git Version
2.25.1
Operating System
Ubuntu 20.04.3 LTS (Focal Fossa)
How are you running Gitea?
I'm running gitea from the binary, through systemctl. I installed it from a tutorial I found online, recently updating it to the latest version, so I can use the generate repo endpoint.
Database
MySQL
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Description
Whenever I create a new repo from a template repo, I get back the repository detail as the request response, but the
default_branch
property is returned as an empty string. I think It should be the default branch, since when I fetch the detail of it in the next request, it's there, therefore I concluded this is a bug.Allow me to send a gist with the entire response from the API https://gist.github.com/truesteps/43b4b13ac3619c92cbdc70c5622c6e02
Screenshots
The text was updated successfully, but these errors were encountered: