summaryrefslogtreecommitdiffstats
path: root/modules/repository
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-12-03 10:48:26 +0800
committerGitHub <noreply@github.com>2022-12-03 10:48:26 +0800
commit0a7d3ff786508284224ada17956a65bb759d9265 (patch)
tree4860fca95c1432ab59c6723ee2b053b1c7d6779d /modules/repository
parent8698458f48eafeab21014db544aa7160368856e1 (diff)
downloadgitea-0a7d3ff786508284224ada17956a65bb759d9265.tar.gz
gitea-0a7d3ff786508284224ada17956a65bb759d9265.zip
refactor some functions to support ctx as first parameter (#21878)
Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules/repository')
-rw-r--r--modules/repository/create_test.go6
-rw-r--r--modules/repository/generate.go2
-rw-r--r--modules/repository/init.go2
3 files changed, 5 insertions, 5 deletions
diff --git a/modules/repository/create_test.go b/modules/repository/create_test.go
index 94a9b26aa6..da4a738b64 100644
--- a/modules/repository/create_test.go
+++ b/modules/repository/create_test.go
@@ -25,7 +25,7 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
testTeamRepositories := func(teamID int64, repoIds []int64) {
team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: teamID})
- assert.NoError(t, team.GetRepositoriesCtx(db.DefaultContext), "%s: GetRepositories", team.Name)
+ assert.NoError(t, team.LoadRepositories(db.DefaultContext), "%s: GetRepositories", team.Name)
assert.Len(t, team.Repos, team.NumRepos, "%s: len repo", team.Name)
assert.Len(t, team.Repos, len(repoIds), "%s: repo count", team.Name)
for i, rid := range repoIds {
@@ -36,7 +36,7 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
}
// Get an admin user.
- user, err := user_model.GetUserByID(1)
+ user, err := user_model.GetUserByID(db.DefaultContext, 1)
assert.NoError(t, err, "GetUserByID")
// Create org.
@@ -153,7 +153,7 @@ func TestUpdateRepositoryVisibilityChanged(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
// Get sample repo and change visibility
- repo, err := repo_model.GetRepositoryByID(9)
+ repo, err := repo_model.GetRepositoryByID(db.DefaultContext, 9)
assert.NoError(t, err)
repo.IsPrivate = true
diff --git a/modules/repository/generate.go b/modules/repository/generate.go
index 5726a8fb1b..d72934729c 100644
--- a/modules/repository/generate.go
+++ b/modules/repository/generate.go
@@ -243,7 +243,7 @@ func generateGitContent(ctx context.Context, repo, templateRepo, generateRepo *r
}
// re-fetch repo
- if repo, err = repo_model.GetRepositoryByIDCtx(ctx, repo.ID); err != nil {
+ if repo, err = repo_model.GetRepositoryByID(ctx, repo.ID); err != nil {
return fmt.Errorf("getRepositoryByID: %w", err)
}
diff --git a/modules/repository/init.go b/modules/repository/init.go
index cd7176c238..59284a5baf 100644
--- a/modules/repository/init.go
+++ b/modules/repository/init.go
@@ -414,7 +414,7 @@ func initRepository(ctx context.Context, repoPath string, u *user_model.User, re
// Re-fetch the repository from database before updating it (else it would
// override changes that were done earlier with sql)
- if repo, err = repo_model.GetRepositoryByIDCtx(ctx, repo.ID); err != nil {
+ if repo, err = repo_model.GetRepositoryByID(ctx, repo.ID); err != nil {
return fmt.Errorf("getRepositoryByID: %w", err)
}