refactor: remove unnecessary git command wrapper functions (#38531)

Removed `gitrepo.RunCmd*` functions, because gitcmd.Command works with
Repository directly.

Move some "local filesystem" related function into "localfs.go"
This commit is contained in:
wxiaoguang
2026-07-20 03:17:25 +00:00
committed by GitHub
parent 730b6f2daf
commit 775e3bdb34
53 changed files with 269 additions and 284 deletions
+4 -4
View File
@@ -10,18 +10,18 @@ import (
)
// PushToExternal pushes a managed repository to an external remote.
func PushToExternal(ctx context.Context, repo Repository, opts git.PushOptions) error {
func PushToExternal(ctx context.Context, repo git.RepositoryFacade, opts git.PushOptions) error {
return git.Push(ctx, repoPath(repo), opts)
}
// Push pushes from one managed repository to another managed repository.
func Push(ctx context.Context, fromRepo, toRepo Repository, opts git.PushOptions) error {
// PushManaged pushes from one managed repository to another managed repository.
func PushManaged(ctx context.Context, fromRepo, toRepo git.RepositoryFacade, opts git.PushOptions) error {
opts.Remote = repoPath(toRepo)
return git.Push(ctx, repoPath(fromRepo), opts)
}
// PushFromLocal pushes from a local path to a managed repository.
func PushFromLocal(ctx context.Context, fromLocalPath string, toRepo Repository, opts git.PushOptions) error {
func PushFromLocal(ctx context.Context, fromLocalPath string, toRepo git.RepositoryFacade, opts git.PushOptions) error {
opts.Remote = repoPath(toRepo)
return git.Push(ctx, fromLocalPath, opts)
}