diff options
author | a1012112796 <1012112796@qq.com> | 2021-01-29 16:57:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-29 16:57:45 +0800 |
commit | f19da14c34f3a86a77b45de77f48109fa5edcf78 (patch) | |
tree | 4fff1a4533cebf812334327e2bfaf9743a90bb64 /routers | |
parent | f761c82c94f27193bfb6cd0648e11e491eda4880 (diff) | |
download | gitea-f19da14c34f3a86a77b45de77f48109fa5edcf78.tar.gz gitea-f19da14c34f3a86a77b45de77f48109fa5edcf78.zip |
enhancement: add signoff option in commit form (#14516)
Signed-off-by: a1012112796 <1012112796@qq.com>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/file.go | 3 | ||||
-rw-r--r-- | routers/repo/editor.go | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go index 044d0fe565..2bd57f1460 100644 --- a/routers/api/v1/repo/file.go +++ b/routers/api/v1/repo/file.go @@ -235,6 +235,7 @@ func CreateFile(ctx *context.APIContext) { Author: apiOpts.Dates.Author, Committer: apiOpts.Dates.Committer, }, + Signoff: apiOpts.Signoff, } if opts.Dates.Author.IsZero() { opts.Dates.Author = time.Now() @@ -323,6 +324,7 @@ func UpdateFile(ctx *context.APIContext) { Author: apiOpts.Dates.Author, Committer: apiOpts.Dates.Committer, }, + Signoff: apiOpts.Signoff, } if opts.Dates.Author.IsZero() { opts.Dates.Author = time.Now() @@ -449,6 +451,7 @@ func DeleteFile(ctx *context.APIContext) { Author: apiOpts.Dates.Author, Committer: apiOpts.Dates.Committer, }, + Signoff: apiOpts.Signoff, } if opts.Dates.Author.IsZero() { opts.Dates.Author = time.Now() diff --git a/routers/repo/editor.go b/routers/repo/editor.go index 619912fef7..344174828e 100644 --- a/routers/repo/editor.go +++ b/routers/repo/editor.go @@ -240,6 +240,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo Message: message, Content: strings.ReplaceAll(form.Content, "\r", ""), IsNewFile: isNewFile, + Signoff: form.Signoff, }); err != nil { // This is where we handle all the errors thrown by repofiles.CreateOrUpdateRepoFile if git.IsErrNotExist(err) { @@ -442,6 +443,7 @@ func DeleteFilePost(ctx *context.Context) { NewBranch: branchName, TreePath: ctx.Repo.TreePath, Message: message, + Signoff: form.Signoff, }); err != nil { // This is where we handle all the errors thrown by repofiles.DeleteRepoFile if git.IsErrNotExist(err) || models.IsErrRepoFileDoesNotExist(err) { @@ -650,6 +652,7 @@ func UploadFilePost(ctx *context.Context) { TreePath: form.TreePath, Message: message, Files: form.Files, + Signoff: form.Signoff, }); err != nil { if models.IsErrLFSFileLocked(err) { ctx.Data["Err_TreePath"] = true |