diff --git a/modules/structs/repo_commit.go b/modules/structs/repo_commit.go index b3e98df19..fec7d9760 100644 --- a/modules/structs/repo_commit.go +++ b/modules/structs/repo_commit.go @@ -69,4 +69,5 @@ type CommitDateOptions struct { // CommitAffectedFiles store information about files affected by the commit type CommitAffectedFiles struct { Filename string `json:"filename"` + Status string `json:"status"` } diff --git a/services/convert/git_commit.go b/services/convert/git_commit.go index e726011e0..ac15719c1 100644 --- a/services/convert/git_commit.go +++ b/services/convert/git_commit.go @@ -196,10 +196,11 @@ func ToCommit(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Rep } affectedFileList := make([]*api.CommitAffectedFiles, 0, len(fileStatus.Added)+len(fileStatus.Removed)+len(fileStatus.Modified)) - for _, files := range [][]string{fileStatus.Added, fileStatus.Removed, fileStatus.Modified} { + for filestatus, files := range map[string][]string{"added": fileStatus.Added, "removed": fileStatus.Removed, "modified": fileStatus.Modified} { for _, filename := range files { affectedFileList = append(affectedFileList, &api.CommitAffectedFiles{ Filename: filename, + Status: filestatus, }) } } diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index b7620b9e7..42eda9852 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -16399,6 +16399,10 @@ "filename": { "type": "string", "x-go-name": "Filename" + }, + "status": { + "type": "string", + "x-go-name": "Status" } }, "x-go-package": "code.gitea.io/gitea/modules/structs"