Move git command to git/gitcmd (#35483)

The name cmd is already used in many places and may cause conflicts, so
I chose `gitcmd` instead to minimize potential naming conflicts.
This commit is contained in:
Lunny Xiao
2025-09-15 23:33:12 -07:00
committed by GitHub
parent fe5afcb022
commit 9332ff291b
107 changed files with 690 additions and 558 deletions

View File

@@ -14,6 +14,7 @@ import (
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/git/gitcmd"
repo_service "code.gitea.io/gitea/services/repository"
"github.com/stretchr/testify/assert"
@@ -204,8 +205,8 @@ func TestPushPullRefs(t *testing.T) {
dstPath := t.TempDir()
doGitClone(dstPath, u)(t)
cmd := git.NewCommand("push", "--delete", "origin", "refs/pull/2/head")
stdout, stderr, err := cmd.RunStdString(t.Context(), &git.RunOpts{
cmd := gitcmd.NewCommand("push", "--delete", "origin", "refs/pull/2/head")
stdout, stderr, err := cmd.RunStdString(t.Context(), &gitcmd.RunOpts{
Dir: dstPath,
})
assert.Error(t, err)