Loading
refactor: simplify branch protection default list options
Summary
DefaultBranchProtectionDefaultsOptions.AllowedToPush and AllowedToMerge were *[]*GroupAccessLevel, forcing callers to write &[]*GroupAccessLevel{...} just to satisfy the type. CreateGroup/UpdateGroup also dereferenced that pointer unconditionally when validating against Avatar uploads, panicking whenever the lists were left unset.
This switches both fields to plain []*GroupAccessLevel tagged with Go 1.24+'s omitzero, which preserves the same wire behavior (nil omits the field, an explicit empty slice clears it, a populated slice sends it) without the pointer indirection, and removes the panic risk. I created a playground to showcase this.
Related to #2297 (closed)
Test plan
-
go build ./... -
go vet ./... -
go test .(existing suite, plus new coverage for explicitly clearing the lists via an empty slice onUpdateGroupandUpdateSettings)
Edited by Oscar Tovar