mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 06:45:43 +03:00
#16205 To obtain a closer behavior to the api from github, the status (added, modified, removed) of a file should be available in addition to the filename. See github doc : https://docs.github.com/fr/rest/commits/commits?apiVersion=2022-11-28#get-a-commit
This commit is contained in:
parent
df55f9b189
commit
d7a8d09da0
3 changed files with 7 additions and 1 deletions
|
@ -69,4 +69,5 @@ type CommitDateOptions struct {
|
||||||
// CommitAffectedFiles store information about files affected by the commit
|
// CommitAffectedFiles store information about files affected by the commit
|
||||||
type CommitAffectedFiles struct {
|
type CommitAffectedFiles struct {
|
||||||
Filename string `json:"filename"`
|
Filename string `json:"filename"`
|
||||||
|
Status string `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -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))
|
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 {
|
for _, filename := range files {
|
||||||
affectedFileList = append(affectedFileList, &api.CommitAffectedFiles{
|
affectedFileList = append(affectedFileList, &api.CommitAffectedFiles{
|
||||||
Filename: filename,
|
Filename: filename,
|
||||||
|
Status: filestatus,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
templates/swagger/v1_json.tmpl
generated
4
templates/swagger/v1_json.tmpl
generated
|
@ -16399,6 +16399,10 @@
|
||||||
"filename": {
|
"filename": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "Filename"
|
"x-go-name": "Filename"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"x-go-name": "Status"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||||
|
|
Loading…
Reference in a new issue