Skip to content

Commit f8a4cd1

Browse files
committed
small refactor
1 parent 4315055 commit f8a4cd1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

modules/gitrepo/http.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,22 @@ func serviceCmd(service string) *gitcmd.Command {
2626

2727
func StatelessRPC(ctx context.Context, storageRepo Repository, service string, extraEnvs []string, input io.Reader, output io.Writer) (string, error) {
2828
var stderr bytes.Buffer
29-
if err := serviceCmd(service).AddArguments("--stateless-rpc").
29+
if err := RunCmd(ctx, storageRepo, serviceCmd(service).AddArguments("--stateless-rpc").
3030
AddDynamicArguments(repoPath(storageRepo)).
3131
WithDir(repoPath(storageRepo)).
3232
WithEnv(append(os.Environ(), extraEnvs...)).
3333
WithStderr(&stderr).
3434
WithStdin(input).
3535
WithStdout(output).
36-
WithUseContextTimeout(true).
37-
Run(ctx); err != nil {
36+
WithUseContextTimeout(true)); err != nil {
3837
return stderr.String(), err
3938
}
4039
return "", nil
4140
}
4241

4342
func StatelessRPCAdvertiseRefs(ctx context.Context, storageRepo Repository, service string, extraEnvs []string) ([]byte, error) {
44-
refs, _, err := serviceCmd(service).AddArguments("--stateless-rpc", "--advertise-refs", ".").
43+
refs, _, err := RunCmdBytes(ctx, storageRepo, serviceCmd(service).AddArguments("--stateless-rpc", "--advertise-refs", ".").
4544
WithEnv(append(os.Environ(), extraEnvs...)).
46-
WithDir(repoPath(storageRepo)).
47-
RunStdBytes(ctx)
45+
WithDir(repoPath(storageRepo)))
4846
return refs, err
4947
}

0 commit comments

Comments
 (0)