You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
699 B
27 lines
699 B
7 years ago
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a MIT-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
4 years ago
|
package forms
|
||
7 years ago
|
|
||
|
import (
|
||
4 years ago
|
"net/http"
|
||
|
|
||
|
"code.gitea.io/gitea/modules/context"
|
||
4 years ago
|
"code.gitea.io/gitea/modules/web/middleware"
|
||
4 years ago
|
|
||
|
"gitea.com/go-chi/binding"
|
||
7 years ago
|
)
|
||
|
|
||
|
// NewBranchForm form for creating a new branch
|
||
|
type NewBranchForm struct {
|
||
|
NewBranchName string `binding:"Required;MaxSize(100);GitRefName"`
|
||
4 years ago
|
CreateTag bool
|
||
7 years ago
|
}
|
||
|
|
||
|
// Validate validates the fields
|
||
4 years ago
|
func (f *NewBranchForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||
|
ctx := context.GetContext(req)
|
||
4 years ago
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||
7 years ago
|
}
|