loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

jeremiepozzigithub and committed by
GitHub
d7a8d09d df55f9b1

+7 -1
+1
modules/structs/repo_commit.go
··· 69 69 // CommitAffectedFiles store information about files affected by the commit 70 70 type CommitAffectedFiles struct { 71 71 Filename string `json:"filename"` 72 + Status string `json:"status"` 72 73 }
+2 -1
services/convert/git_commit.go
··· 196 196 } 197 197 198 198 affectedFileList := make([]*api.CommitAffectedFiles, 0, len(fileStatus.Added)+len(fileStatus.Removed)+len(fileStatus.Modified)) 199 - for _, files := range [][]string{fileStatus.Added, fileStatus.Removed, fileStatus.Modified} { 199 + for filestatus, files := range map[string][]string{"added": fileStatus.Added, "removed": fileStatus.Removed, "modified": fileStatus.Modified} { 200 200 for _, filename := range files { 201 201 affectedFileList = append(affectedFileList, &api.CommitAffectedFiles{ 202 202 Filename: filename, 203 + Status: filestatus, 203 204 }) 204 205 } 205 206 }
+4
templates/swagger/v1_json.tmpl
··· 16399 16399 "filename": { 16400 16400 "type": "string", 16401 16401 "x-go-name": "Filename" 16402 + }, 16403 + "status": { 16404 + "type": "string", 16405 + "x-go-name": "Status" 16402 16406 } 16403 16407 }, 16404 16408 "x-go-package": "code.gitea.io/gitea/modules/structs"