Repository: go-gitea/gitea
File: tests/integration/repofiles_change_test.go (Go)

Code before:
			content:  "dmVyc2lvbiBodHRwczovL2dpdC1sZnMuZ2l0aHViLmNvbS9zcGVjL3YxCm9pZCBzaGEyNTY6N2I2YjJjODhkYmE5Zjc2MGExYTU4NDY5YjY3ZmVlMmI2OThlZjdlOTM5OWM0Y2E0ZjM0YTE0Y2NiZTM5ZjYyMwpzaXplIDI3Cg==",
		},
	}

	var responses []*api.ContentsResponse
	for _, detail := range details {
		selfURL := setting.AppURL + "api/v1/repos/user2/lfs/contents/" + detail.filename + "?ref=master"
		htmlURL := setting.AppURL + "user2/lfs/src/branch/master/" + detail.filename
		gitURL := setting.AppURL + "api/v1/repos/user2/lfs/git/blobs/" + detail.sha
		downloadURL := setting.AppURL + "user2/lfs/raw/branch/master/" + detail.filename
		// don't set time related fields because there might be different time in one operation
		responses = append(responses, &api.ContentsResponse{
			Name:          detail.filename,
			Path:          detail.filename,
			SHA:           detail.sha,
			LastCommitSHA: lastCommitSHA,
			Type:          "file",
			Size:          detail.size,
			Encoding:      util.ToPointer("base64"),
			Content:       &detail.content,
			URL:           &selfURL,
			HTMLURL:       &htmlURL,
			GitURL:        &gitURL,
			DownloadURL:   &downloadURL,
			Links: &api.FileLinksResponse{
				Self:    &selfURL,
				GitURL:  &gitURL,
				HTMLURL: &htmlURL,
			},
		})
	}

	return &api.FilesResponse{
		Files: responses,
		Commit: &api.FileCommitResponse{
			CommitMeta: api.CommitMeta{
				URL: setting.AppURL + "api/v1/repos/user2/lfs/git/commits/" + commitID,
				SHA: commitID,
			},
			HTMLURL: setting.AppURL + "user2/lfs/commit/" + commitID,
			Author: &api.CommitUser{
				Identity: api.Identity{
					Name:  "User Two",
					Email: "user2@noreply.example.org",
				},
				Date: time.Now().UTC().Format(time.RFC3339),
			},
			Committer: &api.CommitUser{
				Identity: api.Identity{
					Name:  "User Two",
					Email: "user2@noreply.example.org",

Review comment (suggestion):
don't set times. flaky tests:

```
         	            	--- Expected
        	            	+++ Actual
        	            	@@ -343,3 +343,3 @@
        	            	    },
        	            	-   Date: (string) (len=20) "2025-06-17T08:19:32Z"
        	            	+   Date: (string) (len=20) "2025-06-17T08:19:31Z"
        	            	   }),
        	            	@@ -350,3 +350,3 @@
        	            	    },
        	            	-   Date: (string) (len=20) "2025-06-17T08:19:32Z"
        	            	+   Date: (string) (len=20) "2025-06-17T08:19:31Z"
        	            	   }),
        	Test:       	TestChangeRepoFilesForUpdateWithFileRename
```

Code after:
			content:  "dmVyc2lvbiBodHRwczovL2dpdC1sZnMuZ2l0aHViLmNvbS9zcGVjL3YxCm9pZCBzaGEyNTY6N2I2YjJjODhkYmE5Zjc2MGExYTU4NDY5YjY3ZmVlMmI2OThlZjdlOTM5OWM0Y2E0ZjM0YTE0Y2NiZTM5ZjYyMwpzaXplIDI3Cg==",
		},
	}

	var responses []*api.ContentsResponse
	for _, detail := range details {
		selfURL := setting.AppURL + "api/v1/repos/user2/lfs/contents/" + detail.filename + "?ref=master"
		htmlURL := setting.AppURL + "user2/lfs/src/branch/master/" + detail.filename
		gitURL := setting.AppURL + "api/v1/repos/user2/lfs/git/blobs/" + detail.sha
		downloadURL := setting.AppURL + "user2/lfs/raw/branch/master/" + detail.filename
		// don't set time related fields because there might be different time in one operation
		responses = append(responses, &api.ContentsResponse{
			Name:          detail.filename,
			Path:          detail.filename,
			SHA:           detail.sha,
			LastCommitSHA: lastCommitSHA,
			Type:          "file",
			Size:          detail.size,
			Encoding:      util.ToPointer("base64"),
			Content:       &detail.content,
			URL:           &selfURL,
			HTMLURL:       &htmlURL,
			GitURL:        &gitURL,
			DownloadURL:   &downloadURL,
			Links: &api.FileLinksResponse{
				Self:    &selfURL,
				GitURL:  &gitURL,
				HTMLURL: &htmlURL,
			},
		})
	}

	return &api.FilesResponse{
		Files: responses,
		Commit: &api.FileCommitResponse{
			CommitMeta: api.CommitMeta{
				URL: setting.AppURL + "api/v1/repos/user2/lfs/git/commits/" + commitID,
				SHA: commitID,
			},
			HTMLURL: setting.AppURL + "user2/lfs/commit/" + commitID,
			Author: &api.CommitUser{
				Identity: api.Identity{
					Name:  "User Two",
					Email: "user2@noreply.example.org",
				},
			},
			Committer: &api.CommitUser{
				Identity: api.Identity{
					Name:  "User Two",
					Email: "user2@noreply.example.org",
				},