MCPcopy Index your code
hub / github.com/devopsctl/gitlabctl / runProtectBranch

Function runProtectBranch

cmd/edit_branch.go:72–86  ·  view source on GitHub ↗
(cmd *cobra.Command, branch string)

Source from the content-addressed store, hash-verified

70}
71
72func runProtectBranch(cmd *cobra.Command, branch string) error {
73 opts := new(gitlab.ProtectBranchOptions)
74 if cmd.Flag("dev-can-push").Changed {
75 opts.DevelopersCanPush = gitlab.Bool(getFlagBool(cmd, "dev-can-push"))
76 }
77 if cmd.Flag("dev-can-merge").Changed {
78 opts.DevelopersCanMerge = gitlab.Bool(getFlagBool(cmd, "dev-can-merge"))
79 }
80 branchInfo, err := protectBranch(branch, getFlagString(cmd, "project"), opts)
81 if err != nil {
82 return err
83 }
84 printBranchOut(getFlagString(cmd, "out"), branchInfo)
85 return nil
86}
87
88func protectBranch(branch, project string, opts *gitlab.ProtectBranchOptions) (*gitlab.Branch, error) {
89 git, err := newGitlabClient()

Callers 1

edit_branch.goFile · 0.85

Calls 4

getFlagBoolFunction · 0.85
protectBranchFunction · 0.85
getFlagStringFunction · 0.85
printBranchOutFunction · 0.85

Tested by

no test coverage detected