fix(ci): use target repo default branch when -R flag is used in CI commands instead of local branch
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
Description
- fix(ci): use target repo default branch when -R flag is used in CI commands instead of local branch
Fix works by detecting repo override: Check if the -R flag is used
Branching logic:
- If explicit branch (-b) is provided → use it
- If repo override (-R) is used → use target repo's default branch (ignore local branch)
- If no repo override → use local git branch (existing behavior)
- If no git repo → fallback to target repo's default branch
- Backward compatibility: The fix maintains full backward compatibility - existing usage without -R flag works exactly as before
Related Issues
Resolves #7957
How has this been tested?
- Added tests for new branch resolution functionality
- Tested locally by building CLI
Screenshots (if appropriate):
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms) -
Test gap
Closes #7957
Edited by 🤖 GitLab Bot 🤖