mirror of https://github.com/go-gitea/gitea
revert RepoIDs
This commit is contained in:
parent
9a33437cd6
commit
4de1b0514c
|
@ -87,7 +87,7 @@ func (branches BranchList) LoadRepo(ctx context.Context) error {
|
|||
|
||||
type FindBranchOptions struct {
|
||||
db.ListOptions
|
||||
RepoIDs []int64 // overwrites RepoCond if the length is not 0
|
||||
RepoID int64
|
||||
RepoCond builder.Cond
|
||||
ExcludeBranchNames []string
|
||||
CommitCond builder.Cond
|
||||
|
@ -104,10 +104,8 @@ type FindBranchOptions struct {
|
|||
func (opts *FindBranchOptions) Cond() builder.Cond {
|
||||
cond := builder.NewCond()
|
||||
|
||||
if len(opts.RepoIDs) == 1 {
|
||||
opts.RepoCond = builder.Eq{"branch.repo_id": opts.RepoIDs[0]}
|
||||
} else if len(opts.RepoIDs) > 1 {
|
||||
opts.RepoCond = builder.In("branch.repo_id", opts.RepoIDs)
|
||||
if opts.RepoID > 0 {
|
||||
cond = cond.And(builder.Eq{"repo_id": opts.RepoID})
|
||||
}
|
||||
if opts.RepoCond != nil {
|
||||
cond = cond.And(opts.RepoCond)
|
||||
|
|
|
@ -50,7 +50,7 @@ func TestGetDeletedBranches(t *testing.T) {
|
|||
ListOptions: db.ListOptions{
|
||||
ListAll: true,
|
||||
},
|
||||
RepoIDs: []int64{repo.ID},
|
||||
RepoID: repo.ID,
|
||||
IsDeletedBranch: util.OptionalBoolTrue,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
|
|
@ -55,7 +55,7 @@ func FindAllMatchedBranches(ctx context.Context, repoID int64, ruleName string)
|
|||
PageSize: 100,
|
||||
Page: page,
|
||||
},
|
||||
RepoIDs: []int64{repoID},
|
||||
RepoID: repoID,
|
||||
IsDeletedBranch: util.OptionalBoolFalse,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
@ -661,7 +661,7 @@ func RepoAssignment(ctx *Context) context.CancelFunc {
|
|||
}
|
||||
|
||||
branchOpts := git_model.FindBranchOptions{
|
||||
RepoIDs: []int64{ctx.Repo.Repository.ID},
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
IsDeletedBranch: util.OptionalBoolFalse,
|
||||
ListOptions: db.ListOptions{
|
||||
ListAll: true,
|
||||
|
|
|
@ -53,7 +53,7 @@ func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository,
|
|||
ListOptions: db.ListOptions{
|
||||
ListAll: true,
|
||||
},
|
||||
RepoIDs: []int64{repo.ID},
|
||||
RepoID: repo.ID,
|
||||
})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
|
|
|
@ -142,7 +142,7 @@ func DeleteBranch(ctx *context.APIContext) {
|
|||
|
||||
// check whether branches of this repository has been synced
|
||||
totalNumOfBranches, err := git_model.CountBranches(ctx, git_model.FindBranchOptions{
|
||||
RepoIDs: []int64{ctx.Repo.Repository.ID},
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
IsDeletedBranch: util.OptionalBoolFalse,
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -349,7 +349,7 @@ func ListBranches(ctx *context.APIContext) {
|
|||
|
||||
branchOpts := git_model.FindBranchOptions{
|
||||
ListOptions: listOptions,
|
||||
RepoIDs: []int64{ctx.Repo.Repository.ID},
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
IsDeletedBranch: util.OptionalBoolFalse,
|
||||
}
|
||||
var err error
|
||||
|
|
|
@ -685,7 +685,7 @@ func getBranchesAndTagsForRepo(ctx gocontext.Context, repo *repo_model.Repositor
|
|||
defer gitRepo.Close()
|
||||
|
||||
branches, err = git_model.FindBranchNames(ctx, git_model.FindBranchOptions{
|
||||
RepoIDs: []int64{repo.ID},
|
||||
RepoID: repo.ID,
|
||||
ListOptions: db.ListOptions{
|
||||
ListAll: true,
|
||||
},
|
||||
|
@ -742,7 +742,7 @@ func CompareDiff(ctx *context.Context) {
|
|||
}
|
||||
|
||||
headBranches, err := git_model.FindBranchNames(ctx, git_model.FindBranchOptions{
|
||||
RepoIDs: []int64{ci.HeadRepo.ID},
|
||||
RepoID: ci.HeadRepo.ID,
|
||||
ListOptions: db.ListOptions{
|
||||
ListAll: true,
|
||||
},
|
||||
|
|
|
@ -630,7 +630,7 @@ type branchTagSearchResponse struct {
|
|||
// GetBranchesList get branches for current repo'
|
||||
func GetBranchesList(ctx *context.Context) {
|
||||
branchOpts := git_model.FindBranchOptions{
|
||||
RepoIDs: []int64{ctx.Repo.Repository.ID},
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
IsDeletedBranch: util.OptionalBoolFalse,
|
||||
ListOptions: db.ListOptions{
|
||||
ListAll: true,
|
||||
|
@ -665,7 +665,7 @@ func GetTagList(ctx *context.Context) {
|
|||
|
||||
func PrepareBranchList(ctx *context.Context) {
|
||||
branchOpts := git_model.FindBranchOptions{
|
||||
RepoIDs: []int64{ctx.Repo.Repository.ID},
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
IsDeletedBranch: util.OptionalBoolFalse,
|
||||
ListOptions: db.ListOptions{
|
||||
ListAll: true,
|
||||
|
|
|
@ -149,7 +149,7 @@ func adoptRepository(ctx context.Context, repoPath string, u *user_model.User, r
|
|||
}
|
||||
|
||||
branches, _ := git_model.FindBranchNames(ctx, git_model.FindBranchOptions{
|
||||
RepoIDs: []int64{repo.ID},
|
||||
RepoID: repo.ID,
|
||||
ListOptions: db.ListOptions{
|
||||
ListAll: true,
|
||||
},
|
||||
|
|
|
@ -73,7 +73,7 @@ func LoadBranches(ctx context.Context, repo *repo_model.Repository, gitRepo *git
|
|||
}
|
||||
|
||||
branchOpts := git_model.FindBranchOptions{
|
||||
RepoIDs: []int64{repo.ID},
|
||||
RepoID: repo.ID,
|
||||
IsDeletedBranch: isDeletedBranch,
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
|
|
Loading…
Reference in New Issue