fix(mr checkout): respect git_protocol configuration instead of hardcoding SSH
-
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
The glab mr checkout
command was hardcoded to use SSH URLs via mrProject.SSHURLToRepo
regardless of the user's git_protocol
configuration setting. This caused issues for users who preferred HTTPS
protocol or worked in environments where SSH was not available.
Changes:
- Replace hardcoded
mrProject.SSHURLToRepo
with protocol-aware URL selection - Add configuration reading to respect the user's
git_protocol
preference - Use
glrepo.RemoteURL()
to select appropriate URL (SSH/HTTPS) based on config - Apply protocol selection for git operations
- fix(mr checkout): respect git_protocol configuration instead of hardcoding SSH
Related Issues
Resolves #7947
How has this been tested?
Tested for mr checkout
by creating a build locally, also added tests for
- Add
runCommandWithConfig()
helper to support configuration testing - Add test case for HTTPS protocol configuration
- Verify that HTTPS URLs are used when
git_protocol
is set to "https"
Screenshots (if appropriate):
Before and After, for after I've used the locally build CLI
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 #7947 (closed)
Edited by 🤖 GitLab Bot 🤖