summaryrefslogtreecommitdiffstats
path: root/services/pull
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-03-29 21:13:41 +0200
committerGitHub <noreply@github.com>2022-03-30 03:13:41 +0800
commit3e88af898a7b8e2697f7e4c3867c34b802d0b660 (patch)
treee8304867b9fd8d78ef0a3da7221d84fb29592c21 /services/pull
parent889a8c268ca6a54ff5be19e61b29b10feb4a12e8 (diff)
downloadgitea-3e88af898a7b8e2697f7e4c3867c34b802d0b660.tar.gz
gitea-3e88af898a7b8e2697f7e4c3867c34b802d0b660.zip
Make git.OpenRepository accept Context (#19260)
* OpenRepositoryCtx -> OpenRepository * OpenRepository -> openRepositoryWithDefaultContext, only for internal usage
Diffstat (limited to 'services/pull')
-rw-r--r--services/pull/check.go2
-rw-r--r--services/pull/patch.go2
-rw-r--r--services/pull/pull.go8
-rw-r--r--services/pull/review.go2
4 files changed, 7 insertions, 7 deletions
diff --git a/services/pull/check.go b/services/pull/check.go
index 3c79abf4b8..f920688f5d 100644
--- a/services/pull/check.go
+++ b/services/pull/check.go
@@ -121,7 +121,7 @@ func getMergeCommit(ctx context.Context, pr *models.PullRequest) (*git.Commit, e
mergeCommit = commitID[:40]
}
- gitRepo, err := git.OpenRepositoryCtx(ctx, pr.BaseRepo.RepoPath())
+ gitRepo, err := git.OpenRepository(ctx, pr.BaseRepo.RepoPath())
if err != nil {
return nil, fmt.Errorf("OpenRepository: %v", err)
}
diff --git a/services/pull/patch.go b/services/pull/patch.go
index 398fadde1a..4c0c91d96a 100644
--- a/services/pull/patch.go
+++ b/services/pull/patch.go
@@ -69,7 +69,7 @@ func TestPatch(pr *models.PullRequest) error {
}
}()
- gitRepo, err := git.OpenRepositoryCtx(ctx, tmpBasePath)
+ gitRepo, err := git.OpenRepository(ctx, tmpBasePath)
if err != nil {
return fmt.Errorf("OpenRepository: %v", err)
}
diff --git a/services/pull/pull.go b/services/pull/pull.go
index 562912cab9..13e4773d8a 100644
--- a/services/pull/pull.go
+++ b/services/pull/pull.go
@@ -83,7 +83,7 @@ func NewPullRequest(ctx context.Context, repo *repo_model.Repository, pull *mode
}
// add first push codes comment
- baseGitRepo, err := git.OpenRepositoryCtx(prCtx, pr.BaseRepo.RepoPath())
+ baseGitRepo, err := git.OpenRepository(prCtx, pr.BaseRepo.RepoPath())
if err != nil {
return err
}
@@ -224,7 +224,7 @@ func checkForInvalidation(ctx context.Context, requests models.PullRequestList,
if err != nil {
return fmt.Errorf("GetRepositoryByID: %v", err)
}
- gitRepo, err := git.OpenRepositoryCtx(ctx, repo.RepoPath())
+ gitRepo, err := git.OpenRepository(ctx, repo.RepoPath())
if err != nil {
return fmt.Errorf("git.OpenRepository: %v", err)
}
@@ -352,7 +352,7 @@ func checkIfPRContentChanged(ctx context.Context, pr *models.PullRequest, oldCom
return false, fmt.Errorf("LoadBaseRepo: %v", err)
}
- headGitRepo, err := git.OpenRepositoryCtx(ctx, pr.HeadRepo.RepoPath())
+ headGitRepo, err := git.OpenRepository(ctx, pr.HeadRepo.RepoPath())
if err != nil {
return false, fmt.Errorf("OpenRepository: %v", err)
}
@@ -752,7 +752,7 @@ func GetIssuesLastCommitStatus(ctx context.Context, issues models.IssueList) (ma
}
gitRepo, ok := gitRepos[issue.RepoID]
if !ok {
- gitRepo, err = git.OpenRepositoryCtx(ctx, issue.Repo.RepoPath())
+ gitRepo, err = git.OpenRepository(ctx, issue.Repo.RepoPath())
if err != nil {
log.Error("Cannot open git repository %-v for issue #%d[%d]. Error: %v", issue.Repo, issue.Index, issue.ID, err)
continue
diff --git a/services/pull/review.go b/services/pull/review.go
index 111e959a87..cb21d736cf 100644
--- a/services/pull/review.go
+++ b/services/pull/review.go
@@ -127,7 +127,7 @@ func createCodeComment(ctx context.Context, doer *user_model.User, repo *repo_mo
}
gitRepo, closer, err := git.RepositoryFromContextOrOpen(ctx, pr.BaseRepo.RepoPath())
if err != nil {
- return nil, fmt.Errorf("OpenRepository: %v", err)
+ return nil, fmt.Errorf("RepositoryFromContextOrOpen: %v", err)
}
defer closer.Close()