fix: use GitLab API for default branch instead of git remote show
What does this MR do and why?
Fixes #8245 (closed). Replaces all uses of git.GetDefaultBranch() (which runs git remote show and fell back to hardcoded "master" on error) with project.DefaultBranch from the GitLab API, which is the authoritative source and already available at every call site.
Changes
mr create: useTargetProject.DefaultBranch— the project is already fetched before this point, so no extra API call is needed. Removes the now-redundantgetTargetBranch()helper.mr for: fetch project viaapi.GetProject, useDefaultBranch. Removes the unusedremotes/repoRemotefetch andgitimport.stack reorder: fetch project viaapi.GetProject, useDefaultBranch.ciutils.GetDefaultBranch: switch from callingclient.Projects.GetProjectdirectly toapi.GetProject+git.DefaultBranchNamefor consistency with the rest of the codebase.git.GetDefaultBranch/ParseDefaultBranch: fix error fallback from hardcoded"master"togit.DefaultBranchName("main").
MR acceptance checklist
- This MR does not have a documentation impact
- I have added/updated tests