aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2024-02-23 03:18:33 +0100
committerGitHub <noreply@github.com>2024-02-23 02:18:33 +0000
commit7fbdb60fc1152acc9a040dc04b1b0f5a3475b081 (patch)
tree9976167d5b05ad1677606bce409d92e83d17a4de /services/repository
parentb748d62b461f9f23823f8772bc708b44b15a23a7 (diff)
downloadgitea-7fbdb60fc1152acc9a040dc04b1b0f5a3475b081.tar.gz
gitea-7fbdb60fc1152acc9a040dc04b1b0f5a3475b081.zip
Start to migrate from `util.OptionalBool` to `optional.Option[bool]` (#29329)
just create transition helper and migrate two structs
Diffstat (limited to 'services/repository')
-rw-r--r--services/repository/adopt.go3
-rw-r--r--services/repository/branch.go5
2 files changed, 5 insertions, 3 deletions
diff --git a/services/repository/adopt.go b/services/repository/adopt.go
index bfb965063f..7ca68776b5 100644
--- a/services/repository/adopt.go
+++ b/services/repository/adopt.go
@@ -19,6 +19,7 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/gitrepo"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/optional"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
@@ -154,7 +155,7 @@ func adoptRepository(ctx context.Context, repoPath string, u *user_model.User, r
ListOptions: db.ListOptions{
ListAll: true,
},
- IsDeletedBranch: util.OptionalBoolFalse,
+ IsDeletedBranch: optional.Some(false),
})
found := false
diff --git a/services/repository/branch.go b/services/repository/branch.go
index e2e50297af..38781acb58 100644
--- a/services/repository/branch.go
+++ b/services/repository/branch.go
@@ -20,6 +20,7 @@ import (
"code.gitea.io/gitea/modules/gitrepo"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/optional"
"code.gitea.io/gitea/modules/queue"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/timeutil"
@@ -61,7 +62,7 @@ func LoadBranches(ctx context.Context, repo *repo_model.Repository, gitRepo *git
branchOpts := git_model.FindBranchOptions{
RepoID: repo.ID,
- IsDeletedBranch: isDeletedBranch,
+ IsDeletedBranch: isDeletedBranch.ToGeneric(),
ListOptions: db.ListOptions{
Page: page,
PageSize: pageSize,
@@ -239,7 +240,7 @@ func syncBranchToDB(ctx context.Context, repoID, pusherID int64, branchName stri
// we cannot simply insert the branch but need to check we have branches or not
hasBranch, err := db.Exist[git_model.Branch](ctx, git_model.FindBranchOptions{
RepoID: repoID,
- IsDeletedBranch: util.OptionalBoolFalse,
+ IsDeletedBranch: optional.Some(false),
}.ToConds())
if err != nil {
return err