Remove wrong "git.DefaultContext" (#35364)
Some checks failed
cron-translations / crowdin-pull (push) Has been skipped
release-nightly / nightly-binary (push) Has been cancelled
release-nightly / nightly-docker-rootful (push) Has been cancelled
release-nightly / nightly-docker-rootless (push) Has been cancelled

This commit is contained in:
wxiaoguang
2025-08-28 00:31:21 +08:00
committed by GitHub
parent e837c998b7
commit 60246730b5
71 changed files with 384 additions and 476 deletions

View File

@ -4,16 +4,17 @@
package integration
import (
"context"
"strings"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/git"
api "code.gitea.io/gitea/modules/structs"
files_service "code.gitea.io/gitea/services/repository/files"
)
func createFileInBranch(user *user_model.User, repo *repo_model.Repository, treePath, branchName, content string) (*api.FilesResponse, error) {
ctx := context.TODO()
opts := &files_service.ChangeRepoFilesOptions{
Files: []*files_service.ChangeRepoFile{
{
@ -26,10 +27,11 @@ func createFileInBranch(user *user_model.User, repo *repo_model.Repository, tree
Author: nil,
Committer: nil,
}
return files_service.ChangeRepoFiles(git.DefaultContext, repo, user, opts)
return files_service.ChangeRepoFiles(ctx, repo, user, opts)
}
func deleteFileInBranch(user *user_model.User, repo *repo_model.Repository, treePath, branchName string) (*api.FilesResponse, error) {
ctx := context.TODO()
opts := &files_service.ChangeRepoFilesOptions{
Files: []*files_service.ChangeRepoFile{
{
@ -41,7 +43,7 @@ func deleteFileInBranch(user *user_model.User, repo *repo_model.Repository, tree
Author: nil,
Committer: nil,
}
return files_service.ChangeRepoFiles(git.DefaultContext, repo, user, opts)
return files_service.ChangeRepoFiles(ctx, repo, user, opts)
}
func createOrReplaceFileInBranch(user *user_model.User, repo *repo_model.Repository, treePath, branchName, content string) error {