新增:分支查询删除分支与普通分支

This commit is contained in:
yystopf 2024-01-05 13:55:20 +08:00
parent cf8779216a
commit 8f0e78026d
1 changed files with 10 additions and 1 deletions

View File

@ -35,11 +35,20 @@ func ListBranches(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "Load git repository failed", nil)
return
}
var isDeleted util.OptionalBool
switch ctx.FormString("state") {
case "all":
isDeleted = util.OptionalBoolNone
case "deleted":
isDeleted = util.OptionalBoolTrue
default:
isDeleted = util.OptionalBoolFalse
}
branchOpts := git_model.FindBranchOptions{
ListOptions: listOptions,
RepoID: ctx.Repo.Repository.ID,
IsDeletedBranch: util.OptionalBoolNone,
IsDeletedBranch: isDeleted,
Keyword: searchName,
}