mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Option to set default branch at repository creation (#10803)
* 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>
This commit is contained in:
		@@ -218,14 +218,15 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
 | 
			
		||||
		opt.Readme = "Default"
 | 
			
		||||
	}
 | 
			
		||||
	repo, err := repo_service.CreateRepository(ctx.User, owner, models.CreateRepoOptions{
 | 
			
		||||
		Name:        opt.Name,
 | 
			
		||||
		Description: opt.Description,
 | 
			
		||||
		IssueLabels: opt.IssueLabels,
 | 
			
		||||
		Gitignores:  opt.Gitignores,
 | 
			
		||||
		License:     opt.License,
 | 
			
		||||
		Readme:      opt.Readme,
 | 
			
		||||
		IsPrivate:   opt.Private,
 | 
			
		||||
		AutoInit:    opt.AutoInit,
 | 
			
		||||
		Name:          opt.Name,
 | 
			
		||||
		Description:   opt.Description,
 | 
			
		||||
		IssueLabels:   opt.IssueLabels,
 | 
			
		||||
		Gitignores:    opt.Gitignores,
 | 
			
		||||
		License:       opt.License,
 | 
			
		||||
		Readme:        opt.Readme,
 | 
			
		||||
		IsPrivate:     opt.Private,
 | 
			
		||||
		AutoInit:      opt.AutoInit,
 | 
			
		||||
		DefaultBranch: opt.DefaultBranch,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		if models.IsErrRepoAlreadyExist(err) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user