mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-01 06:48:56 +00:00
e81ccc406b
Change all license headers to comply with REUSE specification. Fix #16132 Co-authored-by: flynnnnnnnnnn <flynnnnnnnnnn@github> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
38 lines
1 KiB
Go
38 lines
1 KiB
Go
// Copyright 2017 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package forms
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"code.gitea.io/gitea/modules/context"
|
|
"code.gitea.io/gitea/modules/web/middleware"
|
|
|
|
"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.GetContext(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.GetContext(req)
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
|
}
|