mirror of
https://github.com/hanzoai/forge.git
synced 2026-10-30 15:00:39 +00:00
Source files keep their SPDX-License-Identifier and Hanzo copyright line; the Gitea, Gogs and LFS Test Server copyrights they used to repeat now live once in NOTICE, alongside LICENSE. The header lint accepts any copyright line above the SPDX line, so it no longer demands an upstream one. Co-authored-by: Hanzo Dev <[email protected]>
58 lines
1.2 KiB
Go
58 lines
1.2 KiB
Go
// Copyright 2026 Hanzo AI, Inc. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package forms
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/hanzoai/git/modules/optional"
|
|
"github.com/hanzoai/git/modules/web/middleware"
|
|
"github.com/hanzoai/git/services/context"
|
|
|
|
"github.com/hanzoai/git/modules/binding"
|
|
)
|
|
|
|
type CommitCommonForm struct {
|
|
TreePath string `binding:"MaxSize(500)"`
|
|
CommitSummary string `binding:"MaxSize(100)"`
|
|
CommitMessage string
|
|
CommitChoice string `binding:"Required;MaxSize(50)"`
|
|
NewBranchName string `binding:"GitRefName;MaxSize(100)"`
|
|
LastCommit string
|
|
Signoff bool
|
|
CommitEmail string
|
|
}
|
|
|
|
func (f *CommitCommonForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
|
ctx := context.GetValidateContext(req)
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
|
}
|
|
|
|
type CommitCommonFormInterface interface {
|
|
GetCommitCommonForm() *CommitCommonForm
|
|
}
|
|
|
|
func (f *CommitCommonForm) GetCommitCommonForm() *CommitCommonForm {
|
|
return f
|
|
}
|
|
|
|
type EditRepoFileForm struct {
|
|
CommitCommonForm
|
|
Content optional.Option[string]
|
|
}
|
|
|
|
type DeleteRepoFileForm struct {
|
|
CommitCommonForm
|
|
}
|
|
|
|
type UploadRepoFileForm struct {
|
|
CommitCommonForm
|
|
Files []string
|
|
}
|
|
|
|
type CherryPickForm struct {
|
|
CommitCommonForm
|
|
Revert bool
|
|
}
|