Add support for GIT_CLONE_EXTRA_FLAGS for native git clone
-
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.
What does this MR do?
This merge request introduces the GIT_CLONE_EXTRA_FLAGS variable, allowing users to pass extra arguments to the native git clone operation.
- Adds support for
GIT_CLONE_EXTRA_FLAGSin shell logic - Updates related tests to cover new functionality
Why was this MR needed?
Certain workflows require custom flags for git clone, such as referencing alternate repositories or optimizing clone performance. This change provides greater flexibility for advanced use cases.
What's the best way to test this MR?
To test native cloning with extra flags, set the following variables in your CI job:
variables:
FF_USE_GIT_NATIVE_CLONE: true
GIT_STRATEGY: clone
GIT_CLONE_EXTRA_FLAGS: "--reference-if-available /tmp/test"
This ensures the runner uses the clone strategy and passes your custom flags to the native git clone command. You can adjust GIT_CLONE_EXTRA_FLAGS as needed for your test scenario.
What are the relevant issue numbers?
Edited by Axel von Bertoldi