mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-14 12:46:00 +00:00
feat: adds option to force update new branch in contents routes (#35592)
Allows users to specify a "force" option in API /contents routes when modifying files in a new branch. When "force" is true, and the branch already exists, a force push will occur provided the branch does not have a branch protection rule that disables force pushing. This is useful as a way to manage a branch remotely through only the API. For example in an automated release tool you can pull commits, analyze, and update a release PR branch all remotely without needing to clone or perform any local git operations. Resolve #35538 --------- Co-authored-by: Rob Gonnella <rob.gonnella@papayapay.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -8,12 +8,14 @@ import "time"
|
||||
|
||||
// FileOptions options for all file APIs
|
||||
type FileOptions struct {
|
||||
// message (optional) for the commit of this file. if not supplied, a default message will be used
|
||||
// message (optional) is the commit message of the changes. If not supplied, a default message will be used
|
||||
Message string `json:"message"`
|
||||
// branch (optional) to base this file from. if not given, the default branch is used
|
||||
// branch (optional) is the base branch for the changes. If not supplied, the default branch is used
|
||||
BranchName string `json:"branch" binding:"GitRefName;MaxSize(100)"`
|
||||
// new_branch (optional) will make a new branch from `branch` before creating the file
|
||||
// new_branch (optional) will make a new branch from base branch for the changes. If not supplied, the changes will be committed to the base branch
|
||||
NewBranchName string `json:"new_branch" binding:"GitRefName;MaxSize(100)"`
|
||||
// force_push (optional) will do a force-push if the new branch already exists
|
||||
ForcePush bool `json:"force_push"`
|
||||
// `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
|
||||
Author Identity `json:"author"`
|
||||
Committer Identity `json:"committer"`
|
||||
|
Reference in New Issue
Block a user