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

Feature request - changing default branch name #9542

Closed
clarfonthey opened this issue Dec 30, 2019 · 11 comments · Fixed by #10803
Closed

Feature request - changing default branch name #9542

clarfonthey opened this issue Dec 30, 2019 · 11 comments · Fixed by #10803
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Comments

@clarfonthey
Copy link
Contributor

Right now, gitea always defaults to creating a master branch as the default, and the default can be changed per repo with a setting. It would be nice if we could change the default branch name so that new repos would be created with the given name, e.g. if you wanted to use prod instead of master.

@clarfonthey clarfonthey changed the title Change default branch name Feature request - changing default branch name Dec 30, 2019
@zeripath
Copy link
Contributor

The first branch you push to an empty repository will become the default.

@clarfonthey
Copy link
Contributor Author

You're given the option to initialise the repo with a readme and license, which always chooses master.

@zeripath zeripath added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Dec 30, 2019
@zeripath
Copy link
Contributor

Ok.

Fairly simple thing to do - good first pr.

If you want it quickly stick a bounty on bounty source.

@stale
Copy link

stale bot commented Feb 28, 2020

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale stale bot added the issue/stale label Feb 28, 2020
@clarfonthey
Copy link
Contributor Author

Still would like this.

@stale stale bot removed the issue/stale label Feb 28, 2020
@techknowlogick techknowlogick added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Feb 28, 2020
zeripath added a commit to zeripath/gitea that referenced this issue Mar 23, 2020
Fix go-gitea#9542

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit that referenced this issue Mar 26, 2020
* Option to set default branch at repository creation
* Handle template repos with non-default master branch
* Add DefaultBranch handling on creation to API

Fix #9542

Signed-off-by: Andrew Thornton <art27@cantab.net>
@TimerWolf
Copy link

Is this a typo?

@zeripath
Copy link
Contributor

No it's a go fmt related change. (The Depth: 1 option is used when generating from template repos.)

@TimerWolf
Copy link

TimerWolf commented Mar 26, 2020

@zeripath: fun that you did not notice it, i could be wrong. But before the commit it's only use one white-space with the commit two white-spaces are used.

And you say that it is "Depth: 1" and not "Depth:  1" as the code says, that's why i asked if it was a typo or not, but even if the code works it could be a typo i think depending on how you see on it :)

@zeripath
Copy link
Contributor

It's a go fmt change.

@TimerWolf
Copy link

TimerWolf commented Mar 26, 2020

I don't know what that means, i don't code in go language, i just think it was worth a notice :)

Sorry if bother you...

@zeripath
Copy link
Contributor

Instead of looking at the diff take a look at the file:

if err := git.Clone(templateRepoPath, tmpDir, git.CloneRepoOptions{
Depth: 1,
Branch: templateRepo.DefaultBranch,
}); err != nil {

See how the values now align vertically. Look elsewhere in that file and you'll see various other places where there is vertical aligning.

If you add an attribute to a struct initialiser or definition go fmt will align them.

Go is quite opinionated on its formatting - code should and often must be formatted with gofmt.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants