diff options
author | jeremiepozzigithub <125282390+jeremiepozzigithub@users.noreply.github.com> | 2023-07-20 10:35:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-20 16:35:47 +0800 |
commit | d7a8d09da013f14bf795fa8efc3a0eac7f259d02 (patch) | |
tree | 355df9bdcb45c343624a14ea60314a65f1473278 /services | |
parent | df55f9b189174767296e562389948e5250f1df73 (diff) | |
download | gitea-d7a8d09da013f14bf795fa8efc3a0eac7f259d02.tar.gz gitea-d7a8d09da013f14bf795fa8efc3a0eac7f259d02.zip |
Add file status for API "Get a single commit from a repository" (#16205) (#25831)
#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
Diffstat (limited to 'services')
-rw-r--r-- | services/convert/git_commit.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/services/convert/git_commit.go b/services/convert/git_commit.go index e726011e02..ac15719c1c 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, }) } } |