summaryrefslogtreecommitdiffstats
path: root/routers/repo/repo.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-03-26 19:14:51 +0000
committerGitHub <noreply@github.com>2020-03-26 19:14:51 +0000
commit52cfd2743c0e85b36081cf80a850e6a5901f1865 (patch)
tree9b13df2465992cf00fdeb375dd04bd7c17c09f65 /routers/repo/repo.go
parentb1c331c84596f73aeab60178daf92f3539e026b9 (diff)
downloadgitea-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/repo/repo.go')
-rw-r--r--routers/repo/repo.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 5177add99c..3f135dd216 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -221,14 +221,15 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
}
} else {
repo, err = repo_service.CreateRepository(ctx.User, ctxUser, models.CreateRepoOptions{
- Name: form.RepoName,
- Description: form.Description,
- Gitignores: form.Gitignores,
- IssueLabels: form.IssueLabels,
- License: form.License,
- Readme: form.Readme,
- IsPrivate: form.Private || setting.Repository.ForcePrivate,
- AutoInit: form.AutoInit,
+ Name: form.RepoName,
+ Description: form.Description,
+ Gitignores: form.Gitignores,
+ IssueLabels: form.IssueLabels,
+ License: form.License,
+ Readme: form.Readme,
+ IsPrivate: form.Private || setting.Repository.ForcePrivate,
+ DefaultBranch: form.DefaultBranch,
+ AutoInit: form.AutoInit,
})
if err == nil {
log.Trace("Repository created [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)