fix: respect repository target branch rules in mr create

What does this MR do and why?

When a project has branch workflow rules configured (Settings → Merge requests → Merge request branch workflow), glab mr create previously ignored those rules and always targeted the repository's default branch. This MR fixes that.

getTargetBranch now calls ListProjectTargetBranchRules (added in client-go v2.11.0, see gitlab-org/api/client-go!2819 (merged)) and matches the source branch against each rule's glob pattern before falling back to git remote show.

Pattern matching follows the same semantics as the GitLab server-side RefMatcher class: * matches any sequence of characters including /.

MR acceptance checklist

  • This MR does not contain any breaking changes.
  • I have added/updated tests.
  • I have updated the documentation (if needed).

Closes #8232 (closed)

Merge request reports

Loading