From eb748f5f3c93e8e347309fc75ea8273c06a5489b Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 9 Feb 2022 20:28:55 +0000 Subject: Add apply-patch, basic revert and cherry-pick functionality (#17902) This code adds a simple endpoint to apply patches to repositories and branches on gitea. This is then used along with the conflicting checking code in #18004 to provide a basic implementation of cherry-pick revert. Now because the buttons necessary for cherry-pick and revert have required us to create a dropdown next to the Browse Source button I've also implemented Create Branch and Create Tag operations. Fix #3880 Fix #17986 Signed-off-by: Andrew Thornton --- modules/structs/repo_file.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules/structs') diff --git a/modules/structs/repo_file.go b/modules/structs/repo_file.go index 71733c90e7..e2947bf7ac 100644 --- a/modules/structs/repo_file.go +++ b/modules/structs/repo_file.go @@ -50,6 +50,14 @@ type UpdateFileOptions struct { FromPath string `json:"from_path" binding:"MaxSize(500)"` } +// ApplyDiffPatchFileOptions options for applying a diff patch +// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used) +type ApplyDiffPatchFileOptions struct { + DeleteFileOptions + // required: true + Content string `json:"content"` +} + // FileLinksResponse contains the links for a repo's file type FileLinksResponse struct { Self *string `json:"self"` -- cgit v1.2.3