mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Use proxy for pull mirror (#22771)
- Use the proxy (if one is specified) for pull mirrors syncs.
- Pulled the code from
c2774d9e80/modules/git/repo.go (L164-L170)
Downstream issue: https://codeberg.org/forgejo/forgejo/issues/302
---------
Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/notification"
|
||||
"code.gitea.io/gitea/modules/process"
|
||||
"code.gitea.io/gitea/modules/proxy"
|
||||
repo_module "code.gitea.io/gitea/modules/repository"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
@@ -215,6 +216,8 @@ func runSync(ctx context.Context, m *repo_model.Mirror) ([]*mirrorSyncResult, bo
|
||||
return nil, false
|
||||
}
|
||||
|
||||
envs := proxy.EnvWithProxy(remoteURL.URL)
|
||||
|
||||
stdoutBuilder := strings.Builder{}
|
||||
stderrBuilder := strings.Builder{}
|
||||
if err := cmd.
|
||||
@@ -222,6 +225,7 @@ func runSync(ctx context.Context, m *repo_model.Mirror) ([]*mirrorSyncResult, bo
|
||||
Run(&git.RunOpts{
|
||||
Timeout: timeout,
|
||||
Dir: repoPath,
|
||||
Env: envs,
|
||||
Stdout: &stdoutBuilder,
|
||||
Stderr: &stderrBuilder,
|
||||
}); err != nil {
|
||||
|
Reference in New Issue
Block a user