mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
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.
38 lines
1.1 KiB
38 lines
1.1 KiB
// Copyright 2017 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package forms
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"code.gitea.io/gitea/modules/web/middleware"
|
|
"code.gitea.io/gitea/services/context"
|
|
|
|
"gitea.com/go-chi/binding"
|
|
)
|
|
|
|
// NewBranchForm form for creating a new branch
|
|
type NewBranchForm struct {
|
|
NewBranchName string `binding:"Required;MaxSize(100);GitRefName"`
|
|
CurrentPath string
|
|
CreateTag bool
|
|
}
|
|
|
|
// Validate validates the fields
|
|
func (f *NewBranchForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
|
ctx := context.GetValidateContext(req)
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
|
}
|
|
|
|
// RenameBranchForm form for rename a branch
|
|
type RenameBranchForm struct {
|
|
From string `binding:"Required;MaxSize(100);GitRefName"`
|
|
To string `binding:"Required;MaxSize(100);GitRefName"`
|
|
}
|
|
|
|
// Validate validates the fields
|
|
func (f *RenameBranchForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
|
ctx := context.GetValidateContext(req)
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
|
}
|
|
|