diff options
author | zeripath <art27@cantab.net> | 2020-03-26 19:14:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-26 19:14:51 +0000 |
commit | 52cfd2743c0e85b36081cf80a850e6a5901f1865 (patch) | |
tree | 9b13df2465992cf00fdeb375dd04bd7c17c09f65 /routers/api | |
parent | b1c331c84596f73aeab60178daf92f3539e026b9 (diff) | |
download | gitea-52cfd2743c0e85b36081cf80a850e6a5901f1865.tar.gz gitea-52cfd2743c0e85b36081cf80a850e6a5901f1865.zip |
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>
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/repo/repo.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 047d8168b3..5eeef9fb9d 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -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) { |