mirror of
https://github.com/go-gitea/gitea.git
synced 2025-09-22 10:08:16 +00:00
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:
@@ -8,6 +8,8 @@ import (
|
||||
"bytes"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/git/gitcmd"
|
||||
)
|
||||
|
||||
// ObjectType git object type
|
||||
@@ -66,15 +68,15 @@ func (repo *Repository) HashObject(reader io.Reader) (ObjectID, error) {
|
||||
}
|
||||
|
||||
func (repo *Repository) hashObject(reader io.Reader, save bool) (string, error) {
|
||||
var cmd *Command
|
||||
var cmd *gitcmd.Command
|
||||
if save {
|
||||
cmd = NewCommand("hash-object", "-w", "--stdin")
|
||||
cmd = gitcmd.NewCommand("hash-object", "-w", "--stdin")
|
||||
} else {
|
||||
cmd = NewCommand("hash-object", "--stdin")
|
||||
cmd = gitcmd.NewCommand("hash-object", "--stdin")
|
||||
}
|
||||
stdout := new(bytes.Buffer)
|
||||
stderr := new(bytes.Buffer)
|
||||
err := cmd.Run(repo.Ctx, &RunOpts{
|
||||
err := cmd.Run(repo.Ctx, &gitcmd.RunOpts{
|
||||
Dir: repo.Path,
|
||||
Stdin: reader,
|
||||
Stdout: stdout,
|
||||
|
Reference in New Issue
Block a user