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
+2 -2
View File
@@ -36,8 +36,8 @@ func checkConflictsMergeTree(ctx context.Context, pr *issues_model.PullRequest,
// Detect whether the pull request introduces changes by comparing the merged tree (treeHash)
// against the current base commit (baseCommitID) using `git diff-tree`. The command returns exit code 0
// if there is no diff between these trees (empty patch) and exit code 1 if there is a diff.
gitErr := gitrepo.RunCmd(ctx, pr.BaseRepo, gitcmd.NewCommand("diff-tree", "-r", "--quiet").
AddDynamicArguments(treeHash, baseCommitID))
gitErr := gitcmd.NewCommand("diff-tree", "-r", "--quiet").
AddDynamicArguments(treeHash, baseCommitID).WithRepo(pr.BaseRepo).Run(ctx)
switch {
case gitErr == nil:
log.Debug("PullRequest[%d]: Patch is empty - ignoring", pr.ID)