aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/repo/http.go')
-rw-r--r--routers/web/repo/http.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/routers/web/repo/http.go b/routers/web/repo/http.go
index 82ac95c1bc..1306a54369 100644
--- a/routers/web/repo/http.go
+++ b/routers/web/repo/http.go
@@ -313,7 +313,7 @@ func dummyInfoRefs(ctx *context.Context) {
return
}
- refs, err := git.NewCommand(ctx, "receive-pack", "--stateless-rpc", "--advertise-refs", ".").RunInDirBytes(tmpDir)
+ refs, _, err := git.NewCommand(ctx, "receive-pack", "--stateless-rpc", "--advertise-refs", ".").RunStdBytes(&git.RunOpts{Dir: tmpDir})
if err != nil {
log.Error(fmt.Sprintf("%v - %s", err, string(refs)))
}
@@ -397,7 +397,7 @@ func (h *serviceHandler) sendFile(contentType, file string) {
var safeGitProtocolHeader = regexp.MustCompile(`^[0-9a-zA-Z]+=[0-9a-zA-Z]+(:[0-9a-zA-Z]+=[0-9a-zA-Z]+)*$`)
func getGitConfig(ctx gocontext.Context, option, dir string) string {
- out, err := git.NewCommand(ctx, "config", option).RunInDir(dir)
+ out, _, err := git.NewCommand(ctx, "config", option).RunStdString(&git.RunOpts{Dir: dir})
if err != nil {
log.Error("%v - %s", err, out)
}
@@ -472,13 +472,12 @@ func serviceRPC(ctx gocontext.Context, h serviceHandler, service string) {
var stderr bytes.Buffer
cmd := git.NewCommand(h.r.Context(), service, "--stateless-rpc", h.dir)
cmd.SetDescription(fmt.Sprintf("%s %s %s [repo_path: %s]", git.GitExecutable, service, "--stateless-rpc", h.dir))
- if err := cmd.RunWithContext(&git.RunContext{
- Timeout: -1,
- Dir: h.dir,
- Env: append(os.Environ(), h.environ...),
- Stdout: h.w,
- Stdin: reqBody,
- Stderr: &stderr,
+ if err := cmd.Run(&git.RunOpts{
+ Dir: h.dir,
+ Env: append(os.Environ(), h.environ...),
+ Stdout: h.w,
+ Stdin: reqBody,
+ Stderr: &stderr,
}); err != nil {
if err.Error() != "signal: killed" {
log.Error("Fail to serve RPC(%s) in %s: %v - %s", service, h.dir, err, stderr.String())
@@ -512,7 +511,7 @@ func getServiceType(r *http.Request) string {
}
func updateServerInfo(ctx gocontext.Context, dir string) []byte {
- out, err := git.NewCommand(ctx, "update-server-info").RunInDirBytes(dir)
+ out, _, err := git.NewCommand(ctx, "update-server-info").RunStdBytes(&git.RunOpts{Dir: dir})
if err != nil {
log.Error(fmt.Sprintf("%v - %s", err, string(out)))
}
@@ -542,7 +541,7 @@ func GetInfoRefs(ctx *context.Context) {
}
h.environ = append(os.Environ(), h.environ...)
- refs, _, err := git.NewCommand(ctx, service, "--stateless-rpc", "--advertise-refs", ".").RunWithContextBytes(&git.RunContext{Env: h.environ, Dir: h.dir})
+ refs, _, err := git.NewCommand(ctx, service, "--stateless-rpc", "--advertise-refs", ".").RunStdBytes(&git.RunOpts{Env: h.environ, Dir: h.dir})
if err != nil {
log.Error(fmt.Sprintf("%v - %s", err, string(refs)))
}