diff options
Diffstat (limited to 'services/convert/git_commit.go')
-rw-r--r-- | services/convert/git_commit.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/services/convert/git_commit.go b/services/convert/git_commit.go index 119237e0ca..e726011e02 100644 --- a/services/convert/git_commit.go +++ b/services/convert/git_commit.go @@ -10,6 +10,7 @@ import ( repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" + ctx "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" api "code.gitea.io/gitea/modules/structs" @@ -78,6 +79,14 @@ type ToCommitOptions struct { Files bool } +func ParseCommitOptions(ctx *ctx.APIContext) ToCommitOptions { + return ToCommitOptions{ + Stat: ctx.FormString("stat") == "" || ctx.FormBool("stat"), + Files: ctx.FormString("files") == "" || ctx.FormBool("files"), + Verification: ctx.FormString("verification") == "" || ctx.FormBool("verification"), + } +} + // ToCommit convert a git.Commit to api.Commit func ToCommit(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, commit *git.Commit, userCache map[string]*user_model.User, opts ToCommitOptions) (*api.Commit, error) { var apiAuthor, apiCommitter *api.User |