mirror of
https://github.com/gogs/gogs.git
synced 2025-05-31 11:42:13 +00:00
repo/setting: filter out deleted branch in protect list (#4288)
This commit is contained in:
parent
431e930367
commit
7c802f6d83
@ -373,7 +373,15 @@ func SettingsBranches(ctx *context.Context) {
|
|||||||
ctx.Handle(500, "GetProtectBranchesByRepoID", err)
|
ctx.Handle(500, "GetProtectBranchesByRepoID", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Data["ProtectBranches"] = protectBranches
|
|
||||||
|
// Filter out deleted branches
|
||||||
|
branches := make([]string, 0, len(protectBranches))
|
||||||
|
for i := range protectBranches {
|
||||||
|
if ctx.Repo.GitRepo.IsBranchExist(protectBranches[i].Name) {
|
||||||
|
branches = append(branches, protectBranches[i].Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx.Data["ProtectBranches"] = branches
|
||||||
|
|
||||||
ctx.HTML(200, SETTINGS_BRANCHES)
|
ctx.HTML(200, SETTINGS_BRANCHES)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
<div class="ui protected-branches list">
|
<div class="ui protected-branches list">
|
||||||
{{range .ProtectBranches}}
|
{{range .ProtectBranches}}
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<a href="{{$.Link}}/{{.Name}}"><code>{{.Name}}</code></a>
|
<a href="{{$.Link}}/{{.}}"><code>{{.}}</code></a>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user