aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository/files/file_test.go
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-07-30 10:09:04 +0200
committerGitHub <noreply@github.com>2022-07-30 16:09:04 +0800
commit692707f14519b677de4601e5f40469989f82eed6 (patch)
treec59906253034305e2b5be2c6e95bcd76e99a5e51 /services/repository/files/file_test.go
parent2b94b02f33d472c0ae76c398aebe527ba9490ada (diff)
downloadgitea-692707f14519b677de4601e5f40469989f82eed6.tar.gz
gitea-692707f14519b677de4601e5f40469989f82eed6.zip
Add latest commit's SHA to content response (#20398)
* Add latest commit's SHA to content response - When requesting the contents of a filepath, add the latest commit's SHA to the requested file. - Resolves #12840 * Add swagger * Fix NPE * Fix tests * Hook into LastCommitCache * Move AddLastCommitCache to a common nogogit and gogit file Signed-off-by: Andrew Thornton <art27@cantab.net> * Prevent NPE Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'services/repository/files/file_test.go')
-rw-r--r--services/repository/files/file_test.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/services/repository/files/file_test.go b/services/repository/files/file_test.go
index ee0582dfc2..e158c63de2 100644
--- a/services/repository/files/file_test.go
+++ b/services/repository/files/file_test.go
@@ -43,17 +43,18 @@ func getExpectedFileResponse() *api.FileResponse {
downloadURL := setting.AppURL + "user2/repo1/raw/branch/master/" + treePath
return &api.FileResponse{
Content: &api.ContentsResponse{
- Name: treePath,
- Path: treePath,
- SHA: sha,
- Type: "file",
- Size: 30,
- Encoding: &encoding,
- Content: &content,
- URL: &selfURL,
- HTMLURL: &htmlURL,
- GitURL: &gitURL,
- DownloadURL: &downloadURL,
+ Name: treePath,
+ Path: treePath,
+ SHA: sha,
+ LastCommitSHA: "65f1bf27bc3bf70f64657658635e66094edbcb4d",
+ Type: "file",
+ Size: 30,
+ Encoding: &encoding,
+ Content: &content,
+ URL: &selfURL,
+ HTMLURL: &htmlURL,
+ GitURL: &gitURL,
+ DownloadURL: &downloadURL,
Links: &api.FileLinksResponse{
Self: &selfURL,
GitURL: &gitURL,