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 -3
View File
@@ -19,10 +19,11 @@ import (
//
// This behavior is sufficient for temporary operations, such as determining the
// merge base between commits.
func FetchRemoteCommit(ctx context.Context, repo, remoteRepo Repository, commitID string) error {
func FetchRemoteCommit(ctx context.Context, repo, remoteRepo git.RepositoryFacade, commitID string) error {
return git.LockWriteAndDo(ctx, repo, func(ctx context.Context) error {
return RunCmd(ctx, repo, gitcmd.NewCommand("fetch", "--no-tags").
return gitcmd.NewCommand("fetch", "--no-tags").
AddDynamicArguments(repoPath(remoteRepo)).
AddDynamicArguments(commitID))
AddDynamicArguments(commitID).
WithRepo(repo).Run(ctx)
})
}