aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
authorAbheek Dhawan <67982792+ADawesomeguy@users.noreply.github.com>2022-03-26 21:56:28 -0500
committerGitHub <noreply@github.com>2022-03-27 03:56:28 +0100
commitf3165824585b55c0bd75cb4f46120fca8b4ace9f (patch)
tree94642f20ab8dd1b226e2f9077e790795f1229a0c /routers/api/v1/repo
parent71a5aaef32298fd0e82ad9d1549fd38d0eb08352 (diff)
downloadgitea-f3165824585b55c0bd75cb4f46120fca8b4ace9f.tar.gz
gitea-f3165824585b55c0bd75cb4f46120fca8b4ace9f.zip
Set the default branch for repositories generated from templates (#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 #19082 Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/repo.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index d266b3f4f3..7e386d2e5b 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -359,15 +359,16 @@ func Generate(ctx *context.APIContext) {
}
opts := models.GenerateRepoOptions{
- Name: form.Name,
- Description: form.Description,
- Private: form.Private,
- GitContent: form.GitContent,
- Topics: form.Topics,
- GitHooks: form.GitHooks,
- Webhooks: form.Webhooks,
- Avatar: form.Avatar,
- IssueLabels: form.Labels,
+ Name: form.Name,
+ DefaultBranch: form.DefaultBranch,
+ Description: form.Description,
+ Private: form.Private,
+ GitContent: form.GitContent,
+ Topics: form.Topics,
+ GitHooks: form.GitHooks,
+ Webhooks: form.Webhooks,
+ Avatar: form.Avatar,
+ IssueLabels: form.Labels,
}
if !opts.IsValid() {