aboutsummaryrefslogtreecommitdiffstats
path: root/services/pull/temp_repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/pull/temp_repo.go')
-rw-r--r--services/pull/temp_repo.go45
1 files changed, 20 insertions, 25 deletions
diff --git a/services/pull/temp_repo.go b/services/pull/temp_repo.go
index c6c6d8b6e7..22ef53937d 100644
--- a/services/pull/temp_repo.go
+++ b/services/pull/temp_repo.go
@@ -93,11 +93,10 @@ func createTemporaryRepo(ctx context.Context, pr *models.PullRequest) (string, e
var outbuf, errbuf strings.Builder
if err := git.NewCommand(ctx, "remote", "add", "-t", pr.BaseBranch, "-m", pr.BaseBranch, "origin", baseRepoPath).
- RunWithContext(&git.RunContext{
- Timeout: -1,
- Dir: tmpBasePath,
- Stdout: &outbuf,
- Stderr: &errbuf,
+ Run(&git.RunOpts{
+ Dir: tmpBasePath,
+ Stdout: &outbuf,
+ Stderr: &errbuf,
}); err != nil {
log.Error("Unable to add base repository as origin [%s -> %s]: %v\n%s\n%s", pr.BaseRepo.FullName(), tmpBasePath, err, outbuf.String(), errbuf.String())
if err := models.RemoveTemporaryPath(tmpBasePath); err != nil {
@@ -109,11 +108,10 @@ func createTemporaryRepo(ctx context.Context, pr *models.PullRequest) (string, e
errbuf.Reset()
if err := git.NewCommand(ctx, "fetch", "origin", "--no-tags", "--", pr.BaseBranch+":"+baseBranch, pr.BaseBranch+":original_"+baseBranch).
- RunWithContext(&git.RunContext{
- Timeout: -1,
- Dir: tmpBasePath,
- Stdout: &outbuf,
- Stderr: &errbuf,
+ Run(&git.RunOpts{
+ Dir: tmpBasePath,
+ Stdout: &outbuf,
+ Stderr: &errbuf,
}); err != nil {
log.Error("Unable to fetch origin base branch [%s:%s -> base, original_base in %s]: %v:\n%s\n%s", pr.BaseRepo.FullName(), pr.BaseBranch, tmpBasePath, err, outbuf.String(), errbuf.String())
if err := models.RemoveTemporaryPath(tmpBasePath); err != nil {
@@ -125,11 +123,10 @@ func createTemporaryRepo(ctx context.Context, pr *models.PullRequest) (string, e
errbuf.Reset()
if err := git.NewCommand(ctx, "symbolic-ref", "HEAD", git.BranchPrefix+baseBranch).
- RunWithContext(&git.RunContext{
- Timeout: -1,
- Dir: tmpBasePath,
- Stdout: &outbuf,
- Stderr: &errbuf,
+ Run(&git.RunOpts{
+ Dir: tmpBasePath,
+ Stdout: &outbuf,
+ Stderr: &errbuf,
}); err != nil {
log.Error("Unable to set HEAD as base branch [%s]: %v\n%s\n%s", tmpBasePath, err, outbuf.String(), errbuf.String())
if err := models.RemoveTemporaryPath(tmpBasePath); err != nil {
@@ -149,11 +146,10 @@ func createTemporaryRepo(ctx context.Context, pr *models.PullRequest) (string, e
}
if err := git.NewCommand(ctx, "remote", "add", remoteRepoName, headRepoPath).
- RunWithContext(&git.RunContext{
- Timeout: -1,
- Dir: tmpBasePath,
- Stdout: &outbuf,
- Stderr: &errbuf,
+ Run(&git.RunOpts{
+ Dir: tmpBasePath,
+ Stdout: &outbuf,
+ Stderr: &errbuf,
}); err != nil {
log.Error("Unable to add head repository as head_repo [%s -> %s]: %v\n%s\n%s", pr.HeadRepo.FullName(), tmpBasePath, err, outbuf.String(), errbuf.String())
if err := models.RemoveTemporaryPath(tmpBasePath); err != nil {
@@ -175,11 +171,10 @@ func createTemporaryRepo(ctx context.Context, pr *models.PullRequest) (string, e
headBranch = pr.GetGitRefName()
}
if err := git.NewCommand(ctx, "fetch", "--no-tags", remoteRepoName, headBranch+":"+trackingBranch).
- RunWithContext(&git.RunContext{
- Timeout: -1,
- Dir: tmpBasePath,
- Stdout: &outbuf,
- Stderr: &errbuf,
+ Run(&git.RunOpts{
+ Dir: tmpBasePath,
+ Stdout: &outbuf,
+ Stderr: &errbuf,
}); err != nil {
if err := models.RemoveTemporaryPath(tmpBasePath); err != nil {
log.Error("CreateTempRepo: RemoveTemporaryPath: %s", err)