refactor: remove Ctx field from git.Repository (#38500)

This commit is contained in:
wxiaoguang
2026-07-17 18:44:31 +08:00
committed by GitHub
parent 2c8e99bbf7
commit 5b078f72aa
235 changed files with 1234 additions and 1258 deletions
+4 -2
View File
@@ -5,6 +5,8 @@
package git
import (
"context"
"gitea.dev/modules/git/gitcmd"
)
@@ -12,13 +14,13 @@ import (
const BranchPrefix = "refs/heads/"
// AddRemote adds a new remote to repository.
func (repo *Repository) AddRemote(name, url string, fetch bool) error {
func (repo *Repository) AddRemote(ctx context.Context, name, url string, fetch bool) error {
cmd := gitcmd.NewCommand("remote", "add")
if fetch {
cmd.AddArguments("-f")
}
_, _, err := cmd.AddDynamicArguments(name, url).
WithDir(repo.Path).
RunStdString(repo.Ctx)
RunStdString(ctx)
return err
}