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 11:17:25 +08:00
committed by GitHub
parent 730b6f2daf
commit 775e3bdb34
53 changed files with 269 additions and 284 deletions
+3 -2
View File
@@ -8,6 +8,7 @@ import (
"context"
"io"
"gitea.dev/modules/git"
"gitea.dev/modules/git/gitcmd"
"gitea.dev/modules/log"
)
@@ -66,7 +67,7 @@ func parseCommitFileStatus(fileStatus *CommitFileStatus, stdout io.Reader) {
}
// GetCommitFileStatus returns file status of commit in given repository.
func GetCommitFileStatus(ctx context.Context, repo Repository, commitID string) (*CommitFileStatus, error) {
func GetCommitFileStatus(ctx context.Context, repo git.RepositoryFacade, commitID string) (*CommitFileStatus, error) {
cmd := gitcmd.NewCommand("log", "--name-status", "-m", "--pretty=format:", "--first-parent", "--no-renames", "-z", "-1")
stdout, stdoutClose := cmd.MakeStdoutPipe()
defer stdoutClose()
@@ -77,7 +78,7 @@ func GetCommitFileStatus(ctx context.Context, repo Repository, commitID string)
close(done)
}()
err := cmd.AddDynamicArguments(commitID).
WithDir(repoPath(repo)).
WithRepo(repo).
RunWithStderr(ctx)
if err != nil {
return nil, err